Real Airbnb interview questions
Reported questions from this company's loops, tagged by domain, round, and level.
Pythononsite python· L52025
Given a list of side lengths, find the number of possible triangles that can be formed from those lengths.
Python coding question from Airbnb Data Engineer virtual onsite. Expected approach: for each triplet of sides (a, b, c) from the list, check the triangle inequality: a + b > c AND a + c > b AND b + c > a. Brute force: use itertools.combinations(sides, 3) to generate all triplets and count valid ones — O(n^3). Optimized: sort the array first, then for each pair (i, j), use binary search to find the count of valid third sides — O(n^2 log n). Edge cases: duplicate side lengths should still form distinct triangles if at different indices, and degenerate triangles (a + b == c) are typically…
Data Modelingonsite data modeling· L62025
Design a data model for a property booking platform including transaction, user, host, property, pricing, review, and geography tables with primary and foreign key relationships
Airbnb onsite data modeling round. Candidate presented with 5 business requirements and asked to develop a complete data model. Expected entities: transaction table (fact), users, hosts, properties, price table, reviews, geography, and time bucket tables. Interviewer probed on primary/foreign key decisions, normalization vs denormalization trade-offs, how to partition data for scale, and how to handle slowly changing dimensions for pricing. Follow-up: write SQL queries against the model. Corroborated across 3+ independent interview platforms.
SQLtechnical screen· L5
Write SQL queries on different tables
Pythononsite python· L52025
Given a list of file paths, build a nested dictionary representing the directory tree structure
Write a function build_file_tree(paths) that takes a list of file path strings and returns a nested dictionary representing the directory structure. Files (leaf nodes) should have a value of None. Paths are always relative (no leading '/'), contain no '..' or '.' segments, and have no trailing slashes.
Example:
paths = ['src/main.py', 'src/utils/helper.py', 'README.md', 'src/utils/config.py']
Output: {
'src': {
'main.py': None,
'utils': {
'helper.py': None,
'config.py': None
}
},
'README.md': None
}
paths = ['a/b/c/d.txt']
Output:…
Pythononsite python· L52025
Write a function that converts a flat list of parent-child pairs into a nested dictionary tree
Write a function build_tree(pairs) where each pair is a tuple (parent, child). Return the tree as a nested dictionary. Assume a single root node (one value that appears as a parent but never as a child), no cycles, and each child has exactly one parent. Leaf nodes map to an empty dict.
Example:
pairs = [('A', 'B'), ('A', 'C'), ('B', 'D'), ('B', 'E'), ('C', 'F')]
Output: {'A': {'B': {'D': {}, 'E': {}}, 'C': {'F': {}}}}
pairs = [('root', 'a'), ('root', 'b')]
Output: {'root': {'a': {}, 'b': {}}}
pairs = [('x', 'y'), ('y', 'z')]
Output: {'x': {'y': {'z': {}}}}
Edge cases: single…