Airbnb logo

Airbnb Interview Questions

14 practice questions for Airbnb technical interviews

coding Hard Verified

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
coding Hard Verified

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 Medium Verified

Design A Queue


Category: Array coding problem
Design a queue data structure that mimics memory allocation patterns. The queue must store elements in fixed-size blocks (arrays), where each...
Input: Array
Output: Computed result
coding Hard Verified

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

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 Medium Verified

Best Way To Split Stay


Category: Graph coding problem
You are building a property recommendation system for vacation rentals. Given a list of available properties, you need to find the optimal...
Input: Graph (nodes and edges)
Output: Integer
coding Medium Verified

Maximize Task Points


Category: Algorithm coding problem
You are given a set of tasks, each with a deadline and a reward (profit) for completing it. Each task takes exactly one day to complete, and only...
Input: Given input
Output: Computed result
coding Hard Verified

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 Medium Verified

Shortest Maze Path


Category: Grid/matrix coding problem
# Question You are in a maze that is represented as a grid of cells, where each cell is either empty (O) or blocked (X). You can move up, down,...
Input: 2D grid
Output:** Integer
coding Hard Verified

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
system design Senior api design

[OA] Design Twitter-style feed for Airbnb experiences

Building a modern socially-influenced experience for Airbnb is vital to trawl through user-generated content from experiences (such as reviews and photos). This involves creating a class-based structure for managing a user's feed aligned with their interests.
Problem statement: implement a class to handle a simple Twitter-like feed that allows users to create a post, display the feed, and follow other users.
- class TwitterFeed:
- def __init__(self): - Initializes the object.
- def post(self, user_id: int, post: str): - Creates a new post for the specified user.
- def follow(self, follower_id:int, followee_id:int): - Allows one user to follow another.
- def get_feed(self, user_id: int) -> List[str]: - Retrieve the latest n posts from followed users.
Example 1:
Input:
twitter = TwitterFeed()
twitter.post(1, "Looking for cozy places in Paris!")
twitter.post(2, "Trying out local cuisine.")
twitter.follow(1, 2)
print(twitter.get_feed(1)) // returns ["Trying out local cuisine."]
Example 2:
Input:
twitter.follow(1, 3)
print(twitter.get_feed(1)) // returns [] since user 3 has no posts.
Constraints:
- 1 <= user_id <= 10^4
- posts per user = 100
- followed users = 50
system design Senior caching

[OA] LRU Cache — Implement caching for Airbnb property listings

Airbnb needs to optimize its API by implementing a caching mechanism for property listings to reduce database load and improve response time.
Problem statement: Implement an LRU (Least Recently Used) cache with a specified capacity. The cache should support get(key) and put(key, value) operations.
- class LRUCache:
- def __init__(self, capacity: int): - Initializes the LRUCache with the maximum capacity.
- def get(self, key: int) -> int: - Returns the value of the key if the key exists in the cache, otherwise return -1.
- def put(self, key: int, value: int): - Update the value of the key if it exists, otherwise add the key-value pair to the cache. When the cache reaches its capacity, it should invalidate the least recently used item before inserting a new item.
Example 1:
Input:
cache = LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
cache.get(1) // returns 1
cache.put(3, 3) // evicts key 2
cache.get(2) // returns -1 (not found)
Example 2:
Input:
cache.put(4, 4) // evicts key 1
cache.get(1) // returns -1 (not found)
cache.get(3) // returns 3
cache.get(4) // returns 4
Constraints:
- 1 <= capacity <= 3000
- 0 <= key <= 10^4
- 0 <= value <= 10^4
coding Hard sliding window

[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

[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