47 practice questions for Airbnb Data Scientist interviews
Airbnb data scientist interviews test statistical reasoning, ML model design, SQL proficiency, A/B testing methodology, and Python-based algorithm implementation.
Category: Graph coding problemYou 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
codingHardVerified 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
codingMediumVerified Question#3
3. Design A Queue
Category: Array coding problemDesign 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
codingHardVerified Question#4
4. Menu Order Equaling Target Sum
Category: Algorithm coding problemYou 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
codingHardVerified Question#5
5. Most Cost Effective Menu Order
Category: Dynamic programming coding problemYou 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
codingMediumVerified Question#6
6. Best Way To Split Stay
Category: Graph coding problemYou 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
codingMediumVerified Question#7
7. Maximize Task Points
Category: Algorithm coding problemYou 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
codingHardVerified Question#8
8. Collatz Sequence
Category: Algorithm coding problemThe 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
codingMediumVerified 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
codingHardVerified 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
ml designSeniorapi design#1
1. Design a Model Versioning Registry for Airbnb
As Airbnb implements machine learning models for various pricing and recommendation systems, a robust model versioning system is essential for maintaining and deploying different iterations effectively. Problem Statement: You need to design a class ModelVersionRegistry that keeps track of different versions of models with distinct identifiers. Each model could be associated with metadata such as creation date, performance metrics, etc. Implement the class with the following methods: - def add_model(identifier: str, metadata: dict) -> None: Registers a new model with given identifier and its associated metadata. - def get_metadata(identifier: str) -> dict: Returns the metadata associated with the specified identifier. - def find_best_model() -> str: Returns the identifier of the model with the best performance based on some predefined metric stored in the metadata.Example 1: Input: registry = ModelVersionRegistry() registry.add_model('v1', {'accuracy': 0.85, 'created': '2023-01-01'}) registry.get_metadata('v1') Output: {'accuracy': 0.85, 'created': '2023-01-01'}Constraints: - Model identifiers are unique and will be alphanumeric strings. - Metadata will contain various performance metrics.
codingMediumtree#2
2. [OA] Tree Traversal — Analyzing Visitor Trends
Airbnb often analyzes visitor trends over time using tree structures to represent daily bookings across different regions. Efficient traversal methods help understand user engagement better. Problem Statement: Given a binary tree representing bookings, where each node contains a visitor_count, return the maximum sum of visitors from the root to any leaf. You should implement the function: - def max_visitor_path(root: TreeNode) -> int: This function should return the maximum sum of visitor_count along any path from the root to a leaf node.Example 1: Input: root = [2, 7, 5, 3, 4, None, 1] Output: 12 Explanation: The path with the maximum sum is 2 -> 7 -> 3.Constraints: - 1 <= number of nodes <= 1000 - 0 <= visitor_count <= 10000
As Airbnb improves its pricing strategy, it needs to make real-time pricing decisions based on demand fluctuations in various cities. Problem Statement: You are given a list of potential base_prices for a rental property over n days and the rental price can be adjusted once for each given day to either increase or decrease by a percentage (given as a list of percent_changes). Your task is to maximize the price for the last day. You should implement the function: - def max_pricing(base_prices: List[int], percent_changes: List[int]) -> int: This function should return the maximum listing price possible on day n-1 by applying one change at most to each previous day’s price.Example 1: Input: base_prices = [100, 200, 300], percent_changes = [10, -20, 30] Output: 390 Explanation: Adjust the price on the second day to 240 (decrease of 20%) and increase the final day price by 30%, yielding 390.Constraints: - 1 <= n <= 10^4 - 0 <= base_prices[i] <= 10^6 - -100 <= percent_changes[i] <= 100
Airbnb continually aims to improve the user experience by personalizing search results based on user interactions. Using a sliding window approach can help identify the most relevant listings based on user preferences and browsing history. Problem Statement: Given a list of n listings where each listing has a relevance_score and a user’s preference defined as a window_size, return the maximum total relevance_score the user can see in any contiguous subarray of size window_size. You should implement the function: - def max_relevance_score(listings: List[int], window_size: int) -> int: This function should return the maximum sum of relevance_scores of any subarray of size window_size.Example 1: Input: listings = [1, 3, 2, 5, 4], window_size = 3 Output: 10 Explanation: The sum of relevance scores from indices 1 to 3 (3 + 2 + 5) is the maximum.Constraints: - 1 <= n <= 10^5 - 0 <= listings[i] <= 10^6 - 1 <= window_size <= n