← Airbnb Interview Insights

Airbnb·Software Engineer·Technical Phone Screen·Intermediate

IntermediateRejected
Apr 2026

Summary

Airbnb software engineering interview with a heavy focus on object-oriented design. Solved the problem and passed all test cases, still got rejected. Make of that what you will.

Questions Asked (1)

Q1

You start with one box in a house. Each box can contain keys, sub-boxes, and candies. Given this structure, find the maximum number of candies you can collect. Not all boxes require a key to open.

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

The problem itself isn't too bad once you wrap your head around the recursive structure, boxes inside boxes with keys scattered around.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the boxes as a graph where edges represent containment and keys unlock boxes. Use a traversal (BFS/DFS) to explore all reachable boxes, tracking keys and candies, and sum candies from all opened boxes. If boxes can be opened without keys, treat them as initially accessible.

Pro tip: Clarify constraints upfront (e.g., can keys open multiple boxes? Are there cycles?) and discuss trade-offs between BFS and DFS for this problem. Mention that this is similar to a graph traversal with dependencies, and consider edge cases like locked boxes with no keys.

1. Clarify the problem

Ask questions to understand the rules: Are keys reusable? Can a box contain multiple keys? Are there cycles? What is the input format? This ensures you address the correct problem.

2. Model as a graph

Represent each box as a node. Directed edges from a box to its sub-boxes. Keys are attributes that unlock specific boxes. Initially, only boxes without locks are accessible.

3. Choose traversal strategy

Use BFS or DFS to explore all reachable boxes. Maintain a set of collected keys and a set of opened boxes. When a key is found, check if it unlocks any previously inaccessible boxes and add them to the queue/stack.

4. Collect candies

As you open each box, add its candies to a running total. Ensure you don't double-count if a box is reached multiple times (use a visited set).

5. Analyze complexity and edge cases

Discuss time and space complexity (O(N) where N is number of boxes). Consider edge cases: no keys, all boxes locked, cycles, multiple keys for same box.

Key Points to Mention

  • Graph traversal (BFS/DFS) with dynamic unlocking
  • Use of sets for visited boxes and collected keys
  • Handling of initially accessible boxes (no key required)
  • Time and space complexity analysis
  • Edge cases: locked boxes with no keys, cycles, multiple keys
  • Trade-offs between BFS and DFS (e.g., memory vs. recursion depth)

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