← Airbnb Interview Insights

Airbnb·Machine Learning Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
May 2026

Summary

Coding round at Airbnb for an ML Engineer role. One algorithmic question, bowling game scoring, which sounds deceptively simple but has enough edge cases to trip you up if you haven't thought through the 10th frame carefully.

Questions Asked (1)

Q1

Given a sequence of rolls in a standard 10-frame bowling game, compute the total score. Strikes and spares carry bonuses from subsequent rolls, and the 10th frame allows up to two extra rolls. Write clean, modular code with a helper function to score individual frames.

Algorithms & Data Structures
Author's notes

The core logic isn't hard but I fumbled the 10th frame handling for longer than I'd like to admit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the input format (e.g., list of rolls or list of frames) and edge cases like the 10th frame. Then design a modular solution with a helper function that scores each frame based on the next two rolls, and iterate through frames while handling strikes and spares. Finally, test with standard cases and discuss time/space complexity.

Pro tip: Mention that you would write unit tests for edge cases like all strikes, all spares, and mixed games to ensure correctness, and discuss how the modular design aids testing and maintainability.

1. Clarify input and output

Ask whether the input is a list of rolls (e.g., [10, 3, 7, ...]) or a list of frames, and confirm the output is the total score. Discuss handling of the 10th frame's extra rolls.

2. Design helper function

Create a function that takes the rolls list and the current index, and returns the score for the current frame along with the next index. It should handle strikes (10 + next two rolls), spares (10 + next roll), and open frames.

3. Iterate through frames

Loop over 10 frames, calling the helper function each time to accumulate the total score and advance the index appropriately. Ensure the 10th frame is handled correctly with up to three rolls.

4. Test and validate

Test with known games: perfect game (300), all spares (150), and a mixed game. Verify edge cases like strikes in the 10th frame.

5. Analyze complexity

State that the solution runs in O(n) time where n is the number of rolls (max 21), and O(1) extra space. Discuss potential optimizations or alternative approaches.

Key Points to Mention

  • Input format: list of rolls vs. list of frames, and how to handle the 10th frame's extra rolls.
  • Strike bonus: next two rolls; spare bonus: next roll.
  • Modular design with a helper function for frame scoring to improve readability and testability.
  • Edge cases: 10th frame strikes/spares, all strikes, all spares, gutter balls.
  • Time and space complexity: O(n) time, O(1) space.
  • Testing strategy: unit tests for known games and edge cases.

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