← Airbnb Interview Insights

Airbnb·Machine Learning Engineer·Onsite - Coding / Algorithms·Senior

Senior
Jun 2026

Summary

Airbnb MLE coding round with a coin change problem that had a float twist. The float precision pitfall is the kind of thing that seems obvious in hindsight but absolutely isn't in the moment.

Questions Asked (1)

Q1

Given a list of coin denominations expressed as floats (e.g. 0.25, 0.5, 1.0), determine whether a target value can be made from those coins, or find the minimum number of coins needed.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Started doing DP straight on the float values and got maybe halfway through before the interviewer nudged me about precision.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem requirements: whether to just determine feasibility or find the minimum number of coins, and whether unlimited coins of each denomination are available. Then, address the floating-point issue by converting all values to integers (e.g., cents) to avoid precision errors. Finally, discuss dynamic programming for the general case, noting that for canonical coin systems a greedy approach may work, but DP is safer.

Pro tip: Mention that in real-world systems like Airbnb, coin denominations are often canonical, but you should still handle non-canonical cases robustly. Also, emphasize the importance of integer conversion to avoid floating-point errors, which is a common pitfall in financial computations.

1. Clarify requirements and constraints

Ask whether the goal is to check feasibility or find the minimum number of coins, and whether coin supply is unlimited. Also confirm if denominations can be used multiple times.

2. Handle floating-point precision

Convert all denominations and the target to integers by multiplying by a common factor (e.g., 100 for cents) to avoid floating-point errors. Discuss rounding and precision considerations.

3. Choose algorithm based on constraints

For small targets, use dynamic programming (unbounded knapsack) to find the minimum coins or feasibility. For large targets, consider greedy if the coin system is canonical, but verify or use DP with optimizations.

4. Implement and analyze complexity

Implement DP with a 1D array of size target+1, initializing with infinity and dp[0]=0. Time complexity O(target * number of denominations), space O(target).

5. Discuss trade-offs and edge cases

Compare greedy vs DP in terms of time and correctness. Mention edge cases: target=0, unreachable target, negative values, and very large targets requiring alternative approaches.

Key Points to Mention

  • Floating-point precision issues and integer conversion (e.g., to cents)
  • Dynamic programming approach for minimum coins (unbounded knapsack)
  • Greedy algorithm and its limitations (only works for canonical coin systems)
  • Time and space complexity analysis (O(target * denominations) time, O(target) space)
  • Edge cases: target=0, unreachable target, negative values, large target
  • Trade-offs between greedy and DP, and potential optimizations (e.g., BFS, memoization)

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