← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Went through a technical screen for a Research Scientist role at Meta. The focus was on grid traversal and pathfinding, which felt pretty standard but had enough nuance in the follow-ups to keep me on my toes.

Questions Asked (1)

Q1

Given a 2D grid with a start cell and a destination cell, find a path from start to destination while avoiding walls. How do you approach this, and when would you choose BFS over DFS?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I started with BFS because shortest path, but then fumbled a bit explaining why BFS guarantees it on an unweighted grid while DFS doesn't.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem constraints (grid size, movement directions, whether diagonal moves are allowed, and if all edges have equal weight). Then explain that BFS is ideal for finding the shortest path in an unweighted grid, while DFS is suitable for existence checks or when memory is limited. Finally, discuss trade-offs and mention potential optimizations like bidirectional BFS or A* if heuristics are available.

Pro tip: Mention that in an unweighted grid, BFS guarantees the shortest path, but if the grid is very large and the destination is far, bidirectional BFS can significantly reduce time and space. Also, note that DFS might be preferred if you only need to check reachability and want to avoid storing a large queue.

1. Clarify the problem

Ask about grid dimensions, movement rules (4-directional vs 8-directional), whether all moves have equal cost, and if the path needs to be returned or just its existence.

2. Choose the algorithm

Explain that BFS is optimal for shortest path in unweighted grids, while DFS is simpler for reachability and uses less memory in some cases.

3. Outline BFS approach

Describe using a queue, visited set, and parent pointers to reconstruct the path. Mention level-order traversal ensures shortest path.

4. Outline DFS approach

Describe using recursion or stack, marking visited cells, and backtracking. Note it does not guarantee shortest path.

5. Discuss trade-offs and optimizations

Compare time/space complexity, mention bidirectional BFS, A* with Manhattan distance heuristic, and handling edge cases like no path.

Key Points to Mention

  • BFS guarantees shortest path in unweighted graphs; DFS does not.
  • Time complexity: O(V+E) for both, but BFS may use more memory due to queue.
  • Space complexity: BFS O(V) for queue and visited; DFS O(V) for recursion stack in worst case.
  • Use BFS when shortest path is required; use DFS for existence or when memory is constrained.
  • Optimizations: bidirectional BFS, A* with admissible heuristic, early exit when destination found.
  • Edge cases: start equals destination, no path exists, grid boundaries, and obstacles.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.