Facebook - Phone Screen | Find Shortest Path With Obstacles In Grid | Dijkstra + BFS | Clean Code
Round 1
Questions: Find the shortest path from source to destination cell in a grid with obstacles. You can refer to the problem statement here: Leetcode Discussion.
Test Case:
Input Grid: [['1','1','1','1','1'], ['S','1','X','1','1'], ['1','1','1','1','1'], ['X','1','1','E','1'], ['1','1','1','1','X']]
Candidate's Approach
The candidate implemented two algorithms: BFS and Dijkstra's algorithm to find the shortest path in a grid with obstacles. The BFS approach uses a queue to explore all possible paths, while Dijkstra's algorithm employs a priority queue to always expand the least costly path first. The candidate built the shortest path by backtracking from the destination to the source using a parent tracking mechanism.
Interviewer's Feedback
No feedback provided.