← Meta Interview Insights

Meta·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Did a technical screen for an ML Engineer role at Meta and got a graph traversal problem on a 2D maze. Pretty standard stuff but the details matter more than you'd expect.

Questions Asked (1)

Q1

Given a 2D grid with walls and open cells, a start position, and a goal position, find a path from start to goal. Bonus: find the shortest path.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I jumped straight to BFS without really explaining why, which I think cost me points.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints (grid size, movement allowed, obstacles) and then propose BFS for shortest path in an unweighted grid. Discuss trade-offs between BFS and DFS, and mention optimizations like bidirectional BFS or A* if applicable.

Pro tip: Always start by asking clarifying questions about the grid and movement rules; this shows thoroughness and can reveal if the problem is weighted or has other nuances. Also, mention that BFS guarantees shortest path in unweighted graphs, which is often expected at Meta.

1. Clarify the problem

Ask about grid dimensions, movement directions (4 or 8), whether diagonal moves are allowed, and if the grid is static. Confirm that the goal is to find any path, with bonus for shortest.

2. Choose the algorithm

For shortest path in an unweighted grid, BFS is optimal. For any path, DFS works but may not be shortest. Discuss trade-offs: BFS uses more memory but guarantees shortest path; DFS uses less memory but may be slower for shortest path.

3. Outline BFS implementation

Use a queue to explore level by level, track visited cells to avoid cycles, and store parent pointers to reconstruct the path. Return the path when goal is reached.

4. Discuss optimizations

Mention bidirectional BFS to reduce search space, or A* with Manhattan distance heuristic if the grid is large. Note that A* is optimal if heuristic is admissible.

5. Analyze complexity and edge cases

Time complexity O(V+E) where V is number of cells and E is edges (up to 4V). Space O(V). Handle edge cases: start equals goal, no path exists, grid with no obstacles.

Key Points to Mention

  • BFS guarantees shortest path in unweighted graphs
  • Use a queue for BFS and a stack for DFS
  • Track visited cells to avoid infinite loops
  • Reconstruct path using parent pointers
  • Bidirectional BFS can reduce time and space complexity
  • A* with Manhattan distance is efficient for large grids

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