This question evaluates a candidate's ability to design and reason about concurrent algorithms, including parallel BFS, synchronization, thread-safe data structures, partitioning strategies, and correctness guarantees for shortest-path searches.
You are given the classic rotating-lock problem (e.g., a 4-wheel lock from "0000" to a target like "0202" with deadends). In the single-threaded solution, we use BFS over the implicit state graph where each state has up to 8 neighbors (turn each wheel +1 or −1 mod 10). The goal is to find the minimum number of moves.
Assume:
If multiple threads are available, design a parallel BFS for this problem. Describe:
Login required