← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Meta EM interview with a graph traversal problem dressed up in a story about finding some guy named Alibada moving through rooms. Interesting framing but pretty clearly a BFS/DFS question underneath.

Questions Asked (1)

Q1

You have a collection of rooms connected to each other. A person starts in one room and moves to an adjacent room each day. Write a program to determine whether you can find this person given the room layout.

Algorithms & Data Structures
Author's notes

Took me a second to see past the story and realize this is just graph reachability with a time component.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the rooms as an undirected graph and the person's movement as a random walk. Use a multi-source BFS from all possible starting rooms to compute the earliest day the person could be in each room, then check if there is a room that can be reached at all possible days. Alternatively, use a parity-based approach: the set of possible rooms after t days can be updated iteratively, and the person is findable if the intersection of these sets over all t is non-empty.

Pro tip: Clarify with the interviewer whether the person moves deterministically or randomly, and whether you can search one room per day. The problem often reduces to checking if the graph is bipartite or if there's a universal meeting point.

1. Clarify the problem

Ask about the movement rules: does the person move to an adjacent room each day? Can they stay? Do you know the starting room? Can you search one room per day? This determines the algorithm.

2. Model as a graph

Represent rooms as nodes and connections as edges. The person's possible locations after each day form a set that evolves based on adjacency.

3. Choose an algorithm

If the person moves randomly, use BFS to compute the set of possible rooms over time. If deterministic, use parity or bipartite checks. Consider multi-source BFS or dynamic programming.

4. Implement and test

Write code to simulate the possible locations day by day, checking for a room that is always possible. Test with small graphs and edge cases like cycles or disconnected components.

5. Analyze complexity

Discuss time and space complexity. For BFS, it's O(V+E) per day, but you may need to iterate until the set stabilizes. Optimize if needed.

Key Points to Mention

  • Graph representation: adjacency list or matrix
  • BFS/DFS for reachability and shortest paths
  • Set of possible locations and its evolution over time
  • Parity argument for bipartite graphs
  • Handling disconnected components
  • Time and space complexity analysis

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