Airbnb logo

Airbnb Hard Interview Questions

10 hard-level practice questions for Airbnb technical interviews

Airbnb software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Hard Verified Question #1

1. Best Service For Rental Properties


Category: Graph coding problem
You are helping users find the most cost-effective way to get all the services they want for their rental property. You are given: - A list of...
Input: Graph (nodes and edges)
Output: Computed result
Want to practise this one?
Create a free account to open the full question and practise Airbnb questions with AI.
Sign up free
coding Hard Verified Question #2

2. Best Ski Route


Category: Graph coding problem

Question You are skiing down from the top of a mountain and want to maximize your score when you reach the finish. There are multiple routes you...

Input: Graph (nodes and edges)
Output: Computed result
coding Hard Verified Question #3

3. Menu Order Equaling Target Sum


Category: Algorithm coding problem
You are given a menu containing prices of individual items. Given a target amount of money, find all possible combinations of menu items that...
Input: Integer(s)
Output: Integer
coding Hard Verified Question #4

4. Most Cost Effective Menu Order


Category: Dynamic programming coding problem
You are building an app that helps users determine the most cost-effective order they can place at a restaurant for the food items they want. You...
Input: List
Output: Computed result
coding Hard Verified Question #5

5. Collatz Sequence


Category: Algorithm coding problem
The Collatz conjecture is a famous unsolved problem in mathematics. For any positive integer n, the sequence is defined as follows: - If n is...
Input: Integer(s)
Output: Computed result
coding Hard Verified Question #6

6. Implement Refunds


Category: Algorithm coding problem

Question AirBnB has a need to support refunds for our customers in case of booking changes or cancellations.

Input: List
Output: Array
coding Hard dynamic programming #1

1. [AI Enabled Coding] Neighborhood Group Booking Optimizer


Scenario
Airbnb's group-trip planner needs to suggest a collection of available listings in one neighborhood that can accommodate everyone traveling together. Travelers want as little unused capacity as possible and, secondarily, fewer separate properties to coordinate. You may use an AI assistant while implementing the optimizer, but you should explain its correctness and computational limits.
Part 1 — Find the smallest suitable collection
  • Each property record contains id, neighborhood, host_id, capacity, and nightly_price. All keys and values are strings; prices are dollar amounts with exactly two decimal places.

  • Only properties whose neighborhood exactly equals the requested neighborhood are eligible. All input properties are already available for the requested dates, and each may be selected at most once.

  • Select properties with total capacity at least group_size. Minimize total capacity first, then the number of selected properties, then the lexicographically smallest sorted list of property IDs.

  • Return selected IDs in ascending lexicographic order. If no selection can accommodate the group, return an empty selection. Prices and hosts do not affect eligibility or ranking in Part 1.

  • Implement optimize_properties(properties: list[dict[str, str]], neighborhood: str, group_size: int). The return type is up to the candidate; Example 1 uses a JSON array of IDs as its reference representation.


Example 1:
Input:
{
  "properties": [
    {"id": "A", "neighborhood": "Mission", "host_id": "h1", "capacity": "4", "nightly_price": "70.00"},
    {"id": "B", "neighborhood": "Mission", "host_id": "h2", "capacity": "3", "nightly_price": "50.00"},
    {"id": "C", "neighborhood": "Mission", "host_id": "h3", "capacity": "7", "nightly_price": "150.00"},
    {"id": "D", "neighborhood": "Sunset", "host_id": "h4", "capacity": "7", "nightly_price": "120.00"},
    {"id": "E", "neighborhood": "Mission", "host_id": "h5", "capacity": "8", "nightly_price": "100.00"}
  ],
  "neighborhood": "Mission",
  "group_size": 7
}

Output:
["C"]

Explanation: A + B and C both provide exactly 7 places, but C uses one property instead of two. E provides 8 places, and D is ineligible because its neighborhood differs. Price is not an objective.
Part 2 — Add traveler-supplied booking policies
The trip planner now accepts policy records supplied by other product teams. Extend Part 1 without replacing its ranking or neighborhood filtering, and make the approach flexible enough to support future resource-cap policies. Discuss how the return type changes before implementing this extension.
  • Implement optimize_with_policies(properties: list[dict[str, str]], neighborhood: str, group_size: int, policies: list[dict[str, str]]). The return type remains your choice; the examples use a summary object.

  • Support {"type": "nightly_budget", "limit": "120.00"}: the sum of selected nightly prices must be less than or equal to the limit. Use exact cents, not floating-point arithmetic.

  • Support {"type": "host_limit", "limit": "1"}: select at most the specified number of properties from each host. This is a per-host limit, not a limit on the number of distinct hosts.

  • Every supplied policy must hold. An omitted policy imposes no restriction. There is at most one policy of each type; reject an unknown type with ValueError.

  • The optimization order remains total capacity, property count, then sorted IDs. A lower price does not break ties or outrank better capacity utilization.

  • A successful summary contains status: "OK", sorted property_ids, integer total_capacity, and total_nightly_price formatted with two decimal places. An impossible result contains status: "IMPOSSIBLE", an empty ID list, capacity 0, and price "0.00".


Example 2:
Input:
{
  "properties": [
    {"id": "A", "neighborhood": "Mission", "host_id": "h1", "capacity": "4", "nightly_price": "70.00"},
    {"id": "B", "neighborhood": "Mission", "host_id": "h2", "capacity": "3", "nightly_price": "50.00"},
    {"id": "C", "neighborhood": "Mission", "host_id": "h3", "capacity": "7", "nightly_price": "150.00"},
    {"id": "D", "neighborhood": "Sunset", "host_id": "h4", "capacity": "7", "nightly_price": "120.00"},
    {"id": "E", "neighborhood": "Mission", "host_id": "h5", "capacity": "8", "nightly_price": "100.00"}
  ],
  "neighborhood": "Mission",
  "group_size": 7,
  "policies": [
    {"type": "nightly_budget", "limit": "120.00"},
    {"type": "host_limit", "limit": "1"}
  ]
}

Output:
{
  "status": "OK",
  "property_ids": ["A", "B"],
  "total_capacity": 7,
  "total_nightly_price": "120.00"
}

Explanation: A + B provides 4 + 3 = 7 places for 70.00 + 50.00 = 120.00, exactly the budget. Each selected host contributes one property, satisfying the host limit. C exceeds the budget by 30.00. E costs less but provides 8 places, so it loses on the primary objective.
Example 3:
Input:
{
  "properties": [
    {"id": "P", "neighborhood": "Mission", "host_id": "h1", "capacity": "4", "nightly_price": "60.00"},
    {"id": "Q", "neighborhood": "Mission", "host_id": "h1", "capacity": "3", "nightly_price": "40.00"},
    {"id": "R", "neighborhood": "Mission", "host_id": "h2", "capacity": "7", "nightly_price": "130.00"},
    {"id": "S", "neighborhood": "Mission", "host_id": "h3", "capacity": "8", "nightly_price": "101.00"}
  ],
  "neighborhood": "Mission",
  "group_size": 7,
  "policies": [
    {"type": "nightly_budget", "limit": "100.00"},
    {"type": "host_limit", "limit": "1"}
  ]
}

Output:
{
  "status": "IMPOSSIBLE",
  "property_ids": [],
  "total_capacity": 0,
  "total_nightly_price": "0.00"
}

Explanation: P + Q provides 4 + 3 = 7 places for exactly 100.00, but selects two properties from h1, exceeding the limit of 1. R and S individually exceed the budget by 30.00 and 1.00. Adding either to another selection cannot reduce its cost. The selection P + Q + R breaks both policies: its price is 230.00 and its h1 count is 2. The only remaining feasible nonempty selections are P and Q, neither of which accommodates 7 guests.
Notes:
  • There are at most 22 properties, with unique nonempty ASCII IDs; each capacity is an integer from 1 to 20, and group_size is from 1 to 440. Exact optimization is required; explain why greedy selection is insufficient.

  • Prices and budget limits range from "0.00" to "10000.00"; a host limit is an integer string from "0" to "22". Except for unknown policy types, inputs satisfy the stated schema.

  • Prices are nightly totals for the property; ignore taxes, fees, date changes, and simultaneous inventory updates. Future policies supported by your extension mechanism should have hashable sufficient state and irreversible cap violations as properties are added.
Want to practise this one?
Create a free account to open the full question and practise Airbnb questions with AI.
Sign up free
coding Hard dynamic programming #2

2. [Dynamic Programming] — Optimize a group booking across Airbnb properties


Background
Airbnb group-trip planning can require multiple properties when a party cannot fit into one listing. A booking optimizer should select properties in the requested neighborhood while avoiding unnecessary unused capacity and minimizing the number of separate properties travelers must coordinate.
Problem statement
You are given a list of properties, each represented by a record containing a unique integer id, a string neighborhood, and a positive integer capacity. All properties are available for the requested dates, and each property can be selected at most once.
Select a subset of properties in target_neighborhood whose combined capacity is at least group_size. Optimize the selection in this order:
1. Minimize total capacity while accommodating the entire group.
2. Among selections with the same total capacity, minimize the number of properties.
Return the selected property IDs in ascending order. If multiple selections remain tied on both objectives, any tied selection is accepted. Return an empty list if no feasible selection exists, or if group_size is zero. Neighborhood matching is case-sensitive, and travelers may be divided among selected properties without any additional restrictions.
Function or class signature
  • optimize_booking(properties: list[Property], target_neighborhood: str, group_size: int) -> list[int]

  • Property has fields id: int, neighborhood: str, and capacity: int.


Example 1:
Input:
{
  "properties": [
    {"id": 101, "neighborhood": "SoMa", "capacity": 6},
    {"id": 102, "neighborhood": "SoMa", "capacity": 4},
    {"id": 103, "neighborhood": "SoMa", "capacity": 10},
    {"id": 104, "neighborhood": "SoMa", "capacity": 5},
    {"id": 105, "neighborhood": "Mission", "capacity": 10}
  ],
  "target_neighborhood": "SoMa",
  "group_size": 10
}
Output:
[103]
Explanation: Both [101, 102] and [103] provide exactly 10 spaces. Property 103 wins because it uses one property instead of two. Property 105 is in the wrong neighborhood.
Example 2:
Input:
{
  "properties": [
    {"id": 201, "neighborhood": "Mission", "capacity": 6},
    {"id": 202, "neighborhood": "Mission", "capacity": 5},
    {"id": 203, "neighborhood": "Mission", "capacity": 4},
    {"id": 204, "neighborhood": "SoMa", "capacity": 8}
  ],
  "target_neighborhood": "Mission",
  "group_size": 8
}
Output:
[202, 203]
Explanation: No eligible selection has total capacity 8. Properties 202 and 203 provide 9 spaces, which is better than the other feasible totals of 10, 11, and 15.
Constraints:
  • 0 <= len(properties) <= 2000.

  • At most 36 properties belong to target_neighborhood.

  • Property IDs are distinct integers in [1, 10^9].

  • 1 <= capacity <= 10^9.

  • 0 <= group_size <= 10^12.

  • Neighborhood names and target_neighborhood are strings of length 1 through 100.

  • Capacity values are too large for a dynamic-programming table indexed by total capacity.


Follow-up:
Suppose up to 500 properties match the neighborhood, but each capacity is at most 100. How would you replace your algorithm with capacity-indexed dynamic programming while preserving both optimization objectives and reconstructing the selected IDs?
coding Hard sliding window #3

3. [OA] Sliding Window — Implement search function for Airbnb rentals based on dates

Users often look for homes to rent on specific datetime ranges, and it's essential to efficiently check if the rental is available for the requested dates.
Problem statement: Given a list of rental_id with their corresponding availability ranges in the form of pairs (start_date, end_date) and a queried date range, return a list of rental IDs that are available during the entire period of the query.
  • def search_available_rentals(rentals: List[Tuple[int, Tuple[int, int]]], query: Tuple[int, int]) -> List[int]: - Returns rental IDs that are available for the entire query date range.


Example 1:
Input: rentals = [(1, (1, 5)), (2, (2, 6)), (3, (5, 10))], query = (3, 4)
Output: [1, 3]
Explanation: Rentals 1 (1 to 5) and 3 (5 to 10) are available in the range of 3 to 4.
Example 2:
Input: rentals = [(1, (1, 5)), (2, (6, 10)), (3, (5, 10))], query = (2, 4)
Output: [1]
Explanation: Only Rental 1 is available during the queried dates.
Constraints:
  • 1 <= rentals.length <= 10^4

  • 1 <= rental_id <= 10^6

  • 1 <= start_date < end_date <= 10^6

  • 1 <= query[0] < query[1] <= 10^6
coding Hard graph #4

4. [OA] Graph Traversal — Implement a neighbor-finding feature for Airbnb properties

In a platform like Airbnb, it's crucial to find neighboring properties efficiently to help users browse similar options. This will enhance the user experience by showing related listings when a user views a particular property.
Problem statement: You need to implement a function that takes a list of properties represented as nodes in a graph and returns a list of all neighboring properties within a certain distance. Each node has a property_id and a list of neighbors (i.e., directly connected properties).
  • def find_neighbors(properties: List[Property], id: int, distance: int) -> List[int]: - Returns the list of property identifiers of neighboring properties within the specified distance.


Example 1:
Input: properties = [[1, [2, 3]], [2, [1, 4]], [3, [1]], [4, [2]]], id = 1, distance = 1
Output: [2, 3]
Explanation: Property 1 is directly connected to properties 2 and 3.
Example 2:
Input: properties = [[1, [2, 3]], [2, [1, 4]], [3, [1]], [4, [2]]], id = 1, distance = 2
Output: [2, 3, 4]
Explanation: Property 1 is connected to properties 2 and 3 directly, and property 2 connects to property 4.
Constraints:
  • 1 <= properties.length <= 1000

  • 1 <= property_id <= 10^6

  • 0 <= distance <= 50

Start practicing Airbnb questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free