Airbnb logo

Airbnb Interview Questions

48 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
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 Medium Verified Question #3

3. 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 Question #4

4. 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 #5

5. 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 Question #6

6. 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 Question #7

7. 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 Question #8

8. 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 Question #9

9. 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 Question #10

10. 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 Medium hash map #1

1. Coding — Find the Most Booked Property

1. Background: Airbnb displays several rental listings for travelers, and understanding the popularity of these properties helps hosts maximize their bookings and visibility. This problem involves analyzing booking data to identify which property has been booked the most.
2. Problem statement: Given a list of bookings, where each booking is represented as a tuple (property_id, user_id), write a function that returns the property_id of the property that has the most bookings. If there are ties, return the property with the smallest property_id.
3. Function/class signature:
- def most_booked_property(bookings: List[Tuple[int, int]]) -> int:
4. Example 1:
- Input: [(1, 101), (2, 102), (1, 103), (3, 104), (2, 105), (1, 106)]
- Output: 1
- Explanation: Property 1 is booked by users 101, 103, and 106 (3 bookings), while properties 2 and 3 are booked 2 and 1 times respectively.
5. Example 2:
- Input: [(1, 101), (2, 102), (3, 103), (2, 104), (1, 105), (3, 106), (1, 107)]
- Output: 1
- Explanation: Property 1 is booked 3 times, while properties 2 and 3 are tied with 2 bookings each but we choose 1 because it has the most.
6. Constraints:
- 1 <= len(bookings) <= 10^6
- 1 <= property_id, user_id <= 10^9
coding Medium database #2

2. DATABASE — Count Underperforming Listings

1. Background: Airbnb constantly seeks to optimize its platform for hosts and guests. A key metric in this optimization is identifying underperforming listings. This approach directly affects overall customer satisfaction and revenue.
2. Problem statement: Given a list of listings with associated views, bookings, and ratings, determine how many listings are considered underperforming. A listing is classified as underperforming if it has fewer than min_views AND fewer than min_bookings AND a rating lower than min_rating.
3. Function signature: def count_underperforming_listings(listings: List[Tuple[int, int, float]], min_views: int, min_bookings: int, min_rating: float) -> int
4. Example 1:
Input: listings = [(100, 5, 4.5), (50, 3, 4.0), (20, 0, 3.5)], min_views = 30, min_bookings = 2, min_rating = 4.0
Output: 2
Explanation: The last two listings are underperforming as they either have less than 30 views, less than 2 bookings, or a rating below 4.0.
5. Example 2:
Input: listings = [(200, 15, 4.8), (150, 10, 3.0), (40, 1, 2.5)], min_views = 50, min_bookings = 5, min_rating = 3.5
Output: 1
Explanation: Only the last listing is underperforming based on the conditions specified.
6. Constraints:
- The listings array can contain between 1 and 10^4 entries.
- Each entry's views and bookings are non-negative integers.
- Ratings are floats ranging from 0.0 to 5.0.
coding Medium hash map #3

3. Hash Map — Count Listings Based on Reviews

Background: Airbnb has a vast number of listings, each with varying numbers of reviews. Understanding review distributions helps improve listing quality and user satisfaction.
Problem statement: Given a list of reviews represented as strings where each review contains the listing_id, return a hash map (dictionary) that counts the number of reviews for each listing. Each review is structured as "listing_id: review content". The output should be a dictionary where the keys are listing_id and the values are the counts of reviews for that listing.
Function/class signature:
  • def count_reviews(reviews: List[str]) -> Dict[str, int]:


Example 1:
  • Input: reviews = ["1: Great stay!", "1: Loved it!", "2: Not bad.", "1: Would come again."]

  • Output: {'1': 3, '2': 1}

  • Explanation: Listing 1 has three reviews while listing 2 has one.


Example 2:
  • Input: reviews = ["3: Awesome experience!", "3: Best place ever!", "2: Clean and nice."]

  • Output: {'3': 2, '2': 1}

  • Explanation: Listing 3 has two reviews while listing 2 has one.


Constraints:
  • The number of reviews will be at most 10^5.

  • Each review will consist of a valid listing_id followed by text (up to 200 characters).
coding Medium caching #4

4. Caching Underperforming Listings: Identify and cache underperforming listings on Airbnb


Background: Underperforming listings can significantly impact hosts' revenue and guest experiences. Identifying these listings allows Airbnb to provide tailored insights to hosts, enhancing their visibility and ultimately improving booking rates.
Problem statement: You are given a list of listings, where each listing contains its ID, average reviews over the past month, and number of views. Define a function that identifies listings which have received lower than average views compared to the total views of all listings and caches these listings for quick access.
Define the following method:
  • List[int] identify_underperforming_listings(listings: List[Tuple[int, int, int]]) -> List[int]


Example 1:
Input: listings = [(1, 5, 100), (2, 4, 50), (3, 3, 75)]
Output: [2, 3]
Explanation: Listing 2 has 50 views, which is under the average of (100 + 50 + 75) / 3 = 75, and Listing 3 has 75 views, also under average.
Example 2:
Input: listings = [(1, 4, 200), (2, 3, 200), (3, 5, 300)]
Output: []
Explanation: All listings have views equal to or above the average.
Constraints:
  • For listings, 1 ≤ number of listings ≤ 1000

  • Each listing has a unique ID that is an integer from 1 to 10^6

  • Review score is an integer from 1 to 5

  • View count is a non-negative integer up to 10000


coding Medium hash map #5

5. Hash Map — Finding Underperforming Listings

Background: Airbnb depends on optimizing the performance of property listings to enhance user experiences and maximize revenue. Identifying underperforming listings can significantly aid in improving the marketplace.
Problem statement: Given a list of listings where each listing is a dictionary containing id, views, and bookings, implement a function to find listings that are considered *underperforming*. A listing is *underperforming* if its ratio of bookings to views is below a given threshold (e.g., 0.1). Return the IDs of the underperforming listings in ascending order.
Function/class signature:
  • def find_underperforming_listings(listings: List[Dict[str, int]], threshold: float) -> List[int]:

Example 1:
Input: find_underperforming_listings([{ 'id': 1, 'views': 100, 'bookings': 5 }, { 'id': 2, 'views': 200, 'bookings': 1 }, { 'id': 3, 'views': 50, 'bookings': 8 }], 0.1)
Output: [2]
Explanation: Listing 2 has a bookings/views ratio of 0.005 which is below the threshold 0.1.
Example 2:
Input: find_underperforming_listings([{ 'id': 1, 'views': 300, 'bookings': 30 }, { 'id': 2, 'views': 150, 'bookings': 20 }], 0.1)
Output: []
Explanation: Both listings meet the threshold for performance.
Constraints:
  • 1 <= len(listings) <= 10^4

  • 0 <= views, bookings <= 10000

  • 0 < threshold <= 1
coding Medium hash map #6

6. Hash Map — Detect underperforming listings based on rating and booking counts

Background: Airbnb relies on accurate metrics to enhance user experiences and optimize listings' visibility. Identifying underperforming listings can help improve the offerings and marketing strategies.
Problem statement: You are tasked with determining the underperforming listings given a dataset of listings. Each listing has associated ratings and booking counts. A listing is considered underperforming if its average rating is less than 4.0 and it has fewer than 10 bookings. You must implement a function that evaluates this and returns a list of listing IDs that meet these criteria.
Function/class signature:
  • def detect_underperforming_listings(listings: List[Dict[str, Union[int, float]]]) -> List[int]:

Example 1:
Input: listings = [{'id': 1, 'rating': 3.5, 'bookings': 8}, {'id': 2, 'rating': 4.5, 'bookings': 15}, {'id': 3, 'rating': 3.9, 'bookings': 5}]
Output: [1, 3]
Explanation: Listing IDs 1 and 3 are underperforming based on their ratings and booking counts.
Example 2:
Input: listings = [{'id': 4, 'rating': 4.2, 'bookings': 12}, {'id': 5, 'rating': 3.9, 'bookings': 10}, {'id': 6, 'rating': 3.8, 'bookings': 9}]
Output: [5, 6]
Explanation: Listing IDs 5 and 6 do not reach the minimum criteria for ratings or bookings.
Constraints:
  • 1 <= Listings <= 1000

  • Each listing ID is a unique integer.

  • 0 <= bookings <= 1000

  • 0.0 <= rating <= 5.0
coding Medium graph #7

7. Graph — Identify and evaluate underperforming listings

Background: In Airbnb's marketplace, listings that fail to meet certain performance criteria can impact overall business health. Identifying and evaluating these listings are crucial for improving customer satisfaction and optimizing earnings for hosts.
Problem statement: Write a function evaluate_underperforming_listings that takes a list of listings in the form of a dictionary and evaluates them against predefined performance metrics. A listing is considered underperforming if it has a rating below 4.0 or has fewer than 5 bookings. The function should return a list of listing IDs that are underperforming.
Function/class signature:
  • def evaluate_underperforming_listings(listings: List[Dict[str, Union[int, float]]]) -> List[int]:


Example 1:
Input:
[
    {"id": 1, "rating": 4.5, "bookings": 10},
    {"id": 2, "rating": 3.8, "bookings": 2},
    {"id": 3, "rating": 4.0, "bookings": 0}
]

Output:
[2, 3]

Explanation: Listing 2 has a rating below 4.0 and Listing 3 has fewer than 5 bookings, hence both are underperforming.
Example 2:
Input:
[
    {"id": 1, "rating": 4.2, "bookings": 12},
    {"id": 2, "rating": 4.4, "bookings": 5},
    {"id": 3, "rating": 3.9, "bookings": 4}
]

Output:
[3]

Explanation: Only Listing 3 is underperforming based on the given metrics.
Constraints:
  • 1 <= len(listings) <= 1000

  • Each listing contains a unique id with a rating as a float and bookings as an integer.

  • 0 <= bookings <= 100

  • 0.0 <= rating <= 5.0
coding Hard sliding window #8

8. [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 #9

9. [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
system design Senior caching #10

10. [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

Start practicing Airbnb questions

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

Get Started Free