← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Meta coding interview that went deeper than I expected. Started with a maze solver and then they kept adding constraints until it got genuinely tricky.

Questions Asked (2)

Q1

You have a maze solver. Extend it to support directional doors, where each door only allows passage from one specific side. How do you model and traverse these correctly?

Algorithms & Data StructuresSystem Design
Author's notes

I got the basic idea pretty fast, treat each door as a directed edge rather than a bidirectional one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the maze as a graph where each cell is a node and edges represent possible moves, but directional doors require edge attributes. For each door, store the allowed direction(s) of passage and during traversal (BFS/DFS) only consider an edge if the current movement direction matches the door's allowed direction. Clearly separate the maze representation from the traversal algorithm to handle the added constraints.

Pro tip: Emphasize that directional doors are essentially directed edges in the graph; this abstraction simplifies both modeling and traversal. Also, mention that you would validate the solution with edge cases like doors on the maze boundary or cycles of one-way doors.

1. Clarify requirements and assumptions

Ask whether doors can be bidirectional, if multiple doors can exist between same cells, and if the maze is grid-based. Confirm that movement is only allowed in four cardinal directions unless specified otherwise.

2. Model the maze as a graph with directed edges

Represent each cell as a node. For each door, add a directed edge from the source cell to the destination cell only if passage is allowed in that direction. For open passages, add edges in both directions.

3. Adapt traversal algorithm to respect edge directions

Use BFS or DFS, but when exploring neighbors, only follow edges that exist in the graph. This naturally enforces the directional constraints of doors.

4. Handle special cases and optimize

Consider doors that allow multiple directions (e.g., from north and east) by adding multiple directed edges. If performance is critical, discuss using adjacency lists with direction flags or bitmasks to encode allowed directions.

5. Test and validate

Walk through examples: a door that only allows entry from the north should not be traversable from the south. Test with cycles of one-way doors to ensure traversal terminates correctly.

Key Points to Mention

  • Graph representation: cells as nodes, doors as directed edges
  • Traversal algorithms (BFS/DFS) naturally handle directed edges if the graph is built correctly
  • Direction encoding: use bitmasks or enums to represent allowed passage directions
  • Edge cases: doors on boundaries, multiple doors between same cells, cycles of one-way doors
  • Time and space complexity: same as standard maze traversal, O(V+E) for BFS/DFS
  • Separation of concerns: maze model vs. traversal logic for maintainability

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

Q2

What happens when a door's allowed direction points directly into an adjacent wall? How do you make sure your solver blocks that path correctly instead of producing a broken step?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where I fumbled.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem context: this is likely about pathfinding or motion planning where a door's allowed direction is a constraint. Explain that if the direction points into a wall, the path is invalid and must be blocked. Then describe how to detect this geometrically and ensure the solver treats it as an obstacle, possibly by adding a virtual barrier or adjusting the graph.

Pro tip: Mention that you would add a unit test for this edge case and consider using a conservative collision check to avoid tunneling. Also, discuss trade-offs between precomputing blocked directions and runtime checks.

1. Clarify the scenario

Restate the problem: a door has an allowed direction (e.g., one-way passage) that points into an adjacent wall, making it impassable. Confirm assumptions about the environment representation (grid, graph, geometry).

2. Detect the invalid direction

Explain how to check if the door's direction vector intersects a wall. This could be done via raycasting, checking grid cells, or using geometric intersection tests.

3. Block the path in the solver

Describe how to modify the solver's representation: mark the door as blocked, remove the edge, or add a virtual obstacle. Ensure the solver does not attempt to traverse it.

4. Handle edge cases and validation

Discuss handling partial overlaps, thin walls, or dynamic environments. Suggest adding assertions or unit tests to catch such cases.

5. Discuss trade-offs

Compare precomputing blocked doors vs. runtime checks, and consider performance implications for large maps.

Key Points to Mention

  • Geometric intersection tests (raycasting, AABB, etc.)
  • Graph representation: nodes, edges, and how to remove or block an edge
  • Collision detection and avoidance of tunneling
  • Unit testing and edge case validation
  • Performance trade-offs: precomputation vs. runtime checks
  • Robustness: handling dynamic changes or partial walls

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