← Airbnb Interview InsightsSoftware Engineer

Airbnb·Software Engineer·Technical Phone Screen·Intermediate

IntermediateRejected
Jun 2026

Summary

Airbnb SWE interview with a box traversal problem that required OOD thinking, not just a working solution. Passed all test cases and still got rejected, which honestly says a lot about how subjective these rounds can be.

Questions Asked (1)

Q1

You start with one box in a house. Each box can contain keys, sub-boxes, and candies. Keys unlock boxes that are otherwise locked. Some boxes are already open. Find the maximum number of candies you can collect.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

They wanted a full Box class before touching any traversal logic.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the house as a graph where boxes are nodes and edges represent containment or key-unlock relationships. Use a traversal algorithm (e.g., BFS/DFS) to explore reachable boxes, collecting candies and keys, and unlocking boxes when possible. The goal is to maximize candies by efficiently exploring all accessible boxes.

Pro tip: Clarify assumptions early: whether keys are reusable, if boxes can be locked after opening, and if sub-boxes are immediately accessible. This shows attention to detail and prevents misinterpretation.

1. Clarify the problem

Ask questions to understand constraints: Are keys reusable? Can boxes be locked again? Are sub-boxes accessible only if the parent is open? What is the initial state?

2. Model as a graph

Represent boxes as nodes and relationships (containment, key-unlock) as edges. Identify which boxes are initially open and which keys are available.

3. Choose traversal strategy

Use BFS or DFS to explore reachable boxes. Maintain a set of collected keys and a queue of boxes to open. When a key is found, check if it unlocks any known locked boxes.

4. Handle dynamic unlocking

When a key is collected, add any newly unlocked boxes to the exploration queue. Continue until no new boxes can be opened.

5. Optimize and analyze

Discuss time/space complexity (O(N+E) for graph traversal). Consider trade-offs: iterative vs recursive, memory usage, and potential for cycles.

Key Points to Mention

  • Graph representation: boxes as nodes, containment and key-unlock as edges.
  • Traversal algorithms: BFS/DFS to explore reachable boxes.
  • State management: track collected keys, opened boxes, and candies.
  • Dynamic unlocking: process keys to open new boxes and continue exploration.
  • Complexity analysis: O(N+E) time, O(N) space for visited set and queue.
  • Edge cases: cycles, multiple keys for same box, boxes with no candies, initially locked boxes with no keys.

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