Databricks logo

Databricks Software Engineer Interview Questions

21 practice questions for Databricks Software Engineer interviews

Databricks 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
11
Coding
1
System Design
coding Medium Verified Question #1

1. Find Optimal Commute


Category: Grid/matrix coding problem
You are given a 2D grid representing a city map. Each cell contains one of the following: - 'S' -- your starting location - 'D' -- your...
Input: 2D grid
Output: Computed result
Want to practise this one?
Create a free account to open the full question and practise Databricks questions with AI.
Sign up free
coding Hard Verified Question #2

2. IP CIDR Firewall


Category: String coding problem
An IP address is a 32-bit number written as four decimal octets separated by dots, such as 10.0.0.1. A CIDR block is written as base_ip/k, which...
Input: List
Output: Computed result
coding Medium Verified Question #3

3. Bottleneck Dependencies


Category: Graph coding problem
You are managing a build pipeline for a software project. The pipeline contains n components labeled 0 to n-1, connected by prerequisite...
Input: Graph (nodes and edges)
Output: Computed result
coding Hard Verified Question #4

4. Circuit Breaker


Category: Array coding problem
In a distributed system, a circuit breaker mechanism shields backend servers from cascading failures. When a server encounters a streak of...
Input: Array
Output: Computed result
coding Medium Verified Question #5

5. Encode And Decode


Category: Array coding problem
Implement an encoder and decoder for integer arrays using two compression techniques: Run-Length Encoding (RLE) and Bit Packing (BP).
Input: Array of integers
Output: Computed result
coding Medium Verified Question #6

6. Customer Revenue System


Category: Algorithm coding problem
Design a customer revenue tracking system that supports direct sign-ups and referral-based registration. Each customer has a unique auto-incrementing...
Input: List
Output: Array
coding Medium Verified Question #7

7. Design Lazy Array


Category: Array coding problem
Given an integer array, a list of multipliers, and a target value, determine the first index in the array whose element equals the target after all...
Input: Array
Output: Computed result
coding Hard Verified Question #8

8. Find Path in Fibonacci Tree


Category: Binary tree coding problem
A Fibonacci tree of order n is a binary tree defined as follows: - A tree of order 0 is a single node. - A tree of order 1 is a single node.
Input: Binary tree
Output: Computed result
coding Hard Verified Question #9

9. Snapshot Set Iterator


Category: Algorithm coding problem
Design a data structure called SnapshotSet that supports adding and removing integers, membership checks, and capturing immutable snapshots of the...
Input: List
Output: Computed result
coding Medium Verified Question #10

10. Remove Covered Point


Category: Interval-based coding problem
A warehouse uses a shelving system where each shelf occupies a contiguous range of slot positions [start, end) (the end position is exclusive --...
Input: List
Output: Computed result
coding Medium Verified Question #11

11. Tic-Tac-Toe II


Category: Algorithm coding problem
Design a generalized Tic-Tac-Toe game played on an n x m board where the first player to place k consecutive marks in a row, column, or diagonal...
Input: Number(s)
Output: Computed result
system design Hard Verified Question #12

12. Top Databricks System Design Questions


Category: Linked list system design problem

System Design Questions - Databricks These are commonly asked system design questions from Databricks interviews. Updated March 2026.

Input: Linked list
Output: Computed result
coding Hard sliding window #1

1. [AI Enabled Coding] SQL Warehouse Admission Guard


Scenario
Databricks SQL warehouses need admission controls so that one workspace or user cannot consume an unfair share of query-start capacity. Build an in-memory admission evaluator for a batch of query submissions, where each submission has an integer admission weight representing estimated startup work. This is a proposed engineering exercise, not a description of Databricks' production limits; you may use an AI assistant while implementing it, but must verify its boundary handling and atomicity.
Part 1 — Workspace admission rules
  • Every input record contains string fields id, timestamp, workspace, user, and units. Timestamps are integer seconds and units are positive integers encoded as strings.

  • Process records by increasing numeric timestamp, breaking ties by lexicographically increasing id. Return decisions in the original input order.

  • Rule REQUEST_MAX: a submission may request at most 6 units.

  • Rule WORKSPACE_60S: a workspace may admit at most 10 units in the rolling interval (t - 60, t], including the current submission if admitted. A previous admission exactly 60 seconds old no longer counts.

  • Evaluate every rule against previously admitted submissions. Admit a submission only if every rule passes; a rejected submission consumes no capacity. Equality with a limit passes.

  • Report all failed rules, ordered REQUEST_MAX followed by WORKSPACE_60S. Do not stop after the first failure.

  • Function signature: evaluate_admission(records: list[dict[str, str]]). The return type is up to the candidate; the examples use a JSON array containing id, status, and violations, where status is ACCEPTED or REJECTED and violations are rule names.


Example 1:
Input:
{
  "records": [
    {"id":"a","timestamp":"0","workspace":"wA","user":"u1","units":"6"},
    {"id":"b","timestamp":"10","workspace":"wA","user":"u2","units":"5"},
    {"id":"c","timestamp":"20","workspace":"wA","user":"u1","units":"4"},
    {"id":"d","timestamp":"60","workspace":"wA","user":"u1","units":"6"},
    {"id":"e","timestamp":"61","workspace":"wB","user":"u3","units":"7"}
  ]
}

Output:
[
  {"id":"a","status":"ACCEPTED","violations":[]},
  {"id":"b","status":"REJECTED","violations":["WORKSPACE_60S"]},
  {"id":"c","status":"ACCEPTED","violations":[]},
  {"id":"d","status":"ACCEPTED","violations":[]},
  {"id":"e","status":"REJECTED","violations":["REQUEST_MAX"]}
]

Explanation: a uses 6 units. b would raise the workspace total to 6 + 5 = 11, exceeding 10, so it consumes nothing. c raises the total to 6 + 4 = 10. At time 60, a expires, so d produces 4 + 6 = 10. In workspace wB, e would fit the workspace limit, but its 7 units exceed the request limit of 6.
Part 2 — Extensible, atomic multi-scope quotas
Other teams now need independently configurable rolling quotas. Extend the implementation with evaluate_admission_detailed(records: list[dict[str, str]], extra_rules: list[dict[str, str]]), retaining both Part 1 rules.
  • Each additional rule contains string fields rule_id, scope, window_seconds, and limit. Scope is workspace or user. A user scope is the pair (workspace, user), so identically named users in different workspaces do not share capacity.

  • A rolling rule with window W counts previously admitted units in (t - W, t] for its scope. It fails exactly when that count plus the current submission's units exceeds its limit.

  • All rules apply to every submission. Evaluate against the same pre-admission state, then charge all applicable counters if all rules pass, or none if any rule fails. Rejection must not reserve capacity in a rule that passed.

  • Discuss how the return type changes before implementing this extension. The canonical output replaces failed rule names with objects containing rule, scope, used, proposed, and limit. used is the counted admission weight before this submission and proposed = used + units.

  • A request-limit violation uses scope [id] and used = 0. Workspace scopes use [workspace]; user scopes use [workspace, user]. All numeric diagnostic values are JSON integers.

  • Order violations by the two built-in rules first, in Part 1 order, followed by additional rules in lexicographic rule_id order. Output only failed rules.

  • The approach must support future additions of rolling quota rules through configuration without changes to the admission loop. It should also provide a clear extension point for a future rule family. Avoid rescanning all earlier submissions for each decision.


Example 2:
Input:
{
  "records": [
    {"id":"a","timestamp":"0","workspace":"wA","user":"u1","units":"6"},
    {"id":"b","timestamp":"10","workspace":"wA","user":"u2","units":"4"},
    {"id":"c","timestamp":"60","workspace":"wA","user":"u1","units":"3"},
    {"id":"d","timestamp":"61","workspace":"wA","user":"u2","units":"4"}
  ],
  "extra_rules": [
    {"rule_id":"USER_120S","scope":"user","window_seconds":"120","limit":"8"},
    {"rule_id":"WORKSPACE_300S","scope":"workspace","window_seconds":"300","limit":"14"}
  ]
}

Output:
[
  {"id":"a","status":"ACCEPTED","violations":[]},
  {"id":"b","status":"ACCEPTED","violations":[]},
  {"id":"c","status":"REJECTED","violations":[
    {"rule":"USER_120S","scope":["wA","u1"],"used":6,"proposed":9,"limit":8}
  ]},
  {"id":"d","status":"ACCEPTED","violations":[]}
]

Explanation: a and b admit 6 + 4 = 10 units. For c, the 60-second count is 4, so 4 + 3 = 7 passes; its user count is 6, so 6 + 3 = 9 exceeds 8; the 300-second total would be 10 + 3 = 13, which passes. Because c is rejected, none of those counters gain 3 units. For d, the respective rolling totals become 4 + 4 = 8 for the workspace's 60-second rule, 4 + 4 = 8 for user u2, and 10 + 4 = 14 for the 300-second rule, so all pass.
Example 3:
Input:
{
  "records": [
    {"id":"a","timestamp":"0","workspace":"wA","user":"u1","units":"6"},
    {"id":"b","timestamp":"1","workspace":"wA","user":"u2","units":"4"},
    {"id":"c","timestamp":"60","workspace":"wA","user":"u1","units":"7"},
    {"id":"d","timestamp":"120","workspace":"wA","user":"u1","units":"4"}
  ],
  "extra_rules": [
    {"rule_id":"USER_120S","scope":"user","window_seconds":"120","limit":"8"},
    {"rule_id":"WORKSPACE_300S","scope":"workspace","window_seconds":"300","limit":"14"}
  ]
}

Output:
[
  {"id":"a","status":"ACCEPTED","violations":[]},
  {"id":"b","status":"ACCEPTED","violations":[]},
  {"id":"c","status":"REJECTED","violations":[
    {"rule":"REQUEST_MAX","scope":["c"],"used":0,"proposed":7,"limit":6},
    {"rule":"WORKSPACE_60S","scope":["wA"],"used":4,"proposed":11,"limit":10},
    {"rule":"USER_120S","scope":["wA","u1"],"used":6,"proposed":13,"limit":8},
    {"rule":"WORKSPACE_300S","scope":["wA"],"used":10,"proposed":17,"limit":14}
  ]},
  {"id":"d","status":"ACCEPTED","violations":[]}
]

Explanation: At time 60, a has expired only from the 60-second window. Submission c simultaneously fails the request cap, the workspace 60-second cap (4 + 7 = 11), its user cap (6 + 7 = 13), and the workspace 300-second cap (10 + 7 = 17). It consumes nothing. At time 120, both earlier admissions are outside the 60-second window, and a is exactly on the excluded boundary of u1's 120-second window. Thus d yields 0 + 4 = 4 for each of those rules and 10 + 4 = 14 for the 300-second rule, so it is accepted.
Notes:
  • A batch contains at most 200,000 records and 32 additional rules. Timestamps are integers from 0 through 10^12; units, windows, and limits are integers from 1 through 10^9.

  • Inputs are valid. Record IDs are unique; additional rule IDs are unique and do not collide with built-in names. Identifiers contain only ASCII letters, digits, underscores, or hyphens.

  • Each function call starts with empty state. Input order may be arbitrary; this is a single-process batch evaluator, not a distributed concurrency or event-time watermarking exercise.
Want to practise this one?
Create a free account to open the full question and practise Databricks questions with AI.
Sign up free
coding Hard heap #2

2. [IP Access Rules] — Compile ordered CIDR rules for fast batch evaluation


Background
Databricks workspaces need network access controls that distinguish permitted clients from blocked clients. This problem models the IPv4/CIDR rule evaluation reported in Databricks interviews, with an added requirement to compile a large, static policy for repeated lookups; it does not prescribe the semantics of Databricks's production access-control APIs.
Problem statement
You are given an ordered list of IPv4 access rules and a list of client IPv4 addresses. Each rule contains a CIDR string and an action, either "ALLOW" or "DENY".
For each client address, return the action and the zero-based index of the first matching rule in input order. This is not longest-prefix matching: an earlier broad rule overrides a later, more specific rule. If no rule matches, return {"action": "DENY", "rule_index": -1}.
A CIDR with prefix length p matches addresses sharing its first p bits. Normalize host bits in the supplied CIDR: for example, 203.0.113.7/24 means the same network as 203.0.113.0/24. Prefix /0 matches every IPv4 address, and /32 matches exactly one address. Network and broadcast addresses are included; they receive no special treatment.
Compile the rules once, then evaluate the queries in their original order. Do not scan every rule for every query. Your solution must use at most O(N log(N + 1)) preprocessing time, O(log(N + 2)) time per query, and O(N + 1) auxiliary space for the compiled policy, where N is the number of rules. Treat IPv4 parsing and fixed-width integer operations as constant-time operations. Returning the results requires additional output space.
Function or class signature
  • evaluate_access(rules: list[tuple[str, str]], queries: list[str]) -> list[dict[str, str | int]] — Each rule is (cidr, action); each result has exactly action and rule_index.


Example 1:
Input:
{
  "rules": [
    ["10.0.0.0/8", "DENY"],
    ["10.1.0.0/16", "ALLOW"],
    ["192.168.0.0/16", "ALLOW"]
  ],
  "queries": ["10.1.2.3", "192.168.1.8", "8.8.8.8", "10.255.255.255"]
}

Output:
[
  {"action": "DENY", "rule_index": 0},
  {"action": "ALLOW", "rule_index": 2},
  {"action": "DENY", "rule_index": -1},
  {"action": "DENY", "rule_index": 0}
]

Explanation: 10.1.2.3 matches rules 0 and 1, but rule 0 appears first. The last address is included in rule 0's range. 8.8.8.8 matches no rule and is denied by default.
Example 2:
Input:
{
  "rules": [
    ["255.255.255.255/32", "DENY"],
    ["203.0.113.7/24", "ALLOW"],
    ["0.0.0.0/0", "DENY"]
  ],
  "queries": ["203.0.113.0", "203.0.113.255", "255.255.255.255", "0.0.0.0"]
}

Output:
[
  {"action": "ALLOW", "rule_index": 1},
  {"action": "ALLOW", "rule_index": 1},
  {"action": "DENY", "rule_index": 0},
  {"action": "DENY", "rule_index": 2}
]

Explanation: Normalizing rule 1 yields 203.0.113.0/24, including both endpoint addresses. The maximum IPv4 address matches rules 0 and 2, so rule 0 wins. The minimum IPv4 address matches only rule 2.
Constraints:
  • 0 <= N <= 200000 rules and 0 <= Q <= 200000 queries.

  • All addresses are valid dotted-decimal IPv4 strings without leading zeros; all CIDRs have an integer prefix length from 0 through 32.

  • Actions are exactly "ALLOW" or "DENY"; rules may overlap or be duplicates.

  • Rules remain unchanged during evaluation. Query addresses may repeat.

  • IPv4 addresses correspond to unsigned integers in [0, 2^32 - 1]; an exclusive interval endpoint may equal 2^32.


Follow-up:
Rules now have stable integer priorities, with smaller priorities winning, and may be inserted or deleted between queries. How would you redesign the index to support both updates and lookups without recompiling the entire policy? Discuss time and memory trade-offs.
coding Medium dynamic programming #3

3. [Dynamic Programming] — Maximize earnings from a series of house auctions

Background: In the context of Databricks, auctioning houses represents a series of investments where each house can be sold for a specified profit. This problem relates to optimizing revenue from investment in a big data analytics pipeline.
Problem statement: Given an array profits where profits[i] represents the profit of selling the ith house, you want to maximize your total profit. However, you cannot sell two consecutive houses. Implement a function that determines the maximum profit possible from the auctioning of these houses.
Function/class signature:
  • def max_profit(profits: List[int]) -> int:


Example 1:
  • Input: [2, 7, 9, 3, 1]

  • Output: 12

  • Explanation: You can sell house 1 (profit of 7) and house 3 (profit of 9) for a total of 12 profit.


Example 2:
  • Input: [1, 2, 3, 1]

  • Output: 4

  • Explanation: Sell house 1 (profit of 2) and house 3 (profit of 3) for a total of 4 profit.


Constraints:
  • 0 <= profits.length <= 100

  • The values in profits must be non-negative integers and less than 1000.

coding Medium hash map #4

4. Hash Map — Find Two Numbers That Add Up to a Target

Background: In large-scale data processing systems like those at Databricks, effectively managing data with key-value pairs is crucial, especially when optimizing computations and reducing runtime.
Problem statement: You are given an array of integers nums and an integer target. Write a function to find two numbers in nums such that they add up to target. Return their indices as an array. Each input would be such that exactly one solution exists, and you may not use the same element twice.
Function signature:
  • def two_sum(nums: List[int], target: int) -> List[int]:

Example 1:
Input: nums = [2, 7, 11, 15], target = 9
Output: [0, 1]
Explanation: nums[0] + nums[1] = 2 + 7 = 9.
Example 2:
Input: nums = [3, 2, 4], target = 6
Output: [1, 2]
Explanation: nums[1] + nums[2] = 2 + 4 = 6.
Constraints:
  • 2 <= nums.length <= 10^4

  • -10^9 <= nums[i] <= 10^9

  • -10^9 <= target <= 10^9

  • Only one solution exists, and you cannot use the same element twice.
coding Medium heap #5

5. [Heap] — Sliding Window Maximum

Background: In data analytics, processing real-time streams of data is vital. Databricks aims to provide efficient data processing and analytics capabilities, making it essential to quickly retrieve the maximum values in a sliding window from incoming data streams.
Problem statement: Given an array of integers nums and an integer k, return the maximum sliding window for each window of size k. The output should be an array of the maximum values from each sliding window.
Function/class signature:
  • def max_sliding_window(nums: List[int], k: int) -> List[int]:

Example 1:
  • Input: nums = [1,3,-1,-3,5,3,6,7], k = 3

  • Output: [3, 3, 5, 5, 6, 7]

  • Explanation: The maximums of each sliding window are [3], [3], [5], [5], [6], and [7].

Example 2:
  • Input: nums = [1], k = 1

  • Output: [1]

Constraints:
  • 1 <= nums.length <= 10^5

  • -10^4 <= nums[i] <= 10^4

  • 1 <= k <= nums.length

coding Hard api design #6

6. CODING — Implement a stock broker order handler

1. Background: In the Databricks ecosystem for financial services, managing stock orders efficiently and accurately is crucial. This problem relates to the order handling system for a stock broker, which must process orders in a transactional, reliable manner.
2. Problem Statement: You are tasked with developing a system that handles stock orders for a broker. The order system should process BUY and SELL orders and ensure no expired orders are processed. Each order has a unique ID, a stock symbol, a quantity, and a timestamp indicating when it was placed. Expired orders should be automatically removed from processing. Implement the method void processOrder(Order order) and return a list of confirmed orders.
3. Function/class signature:
- class Order:
- def __init__(self, order_id: int, stock_symbol: str, quantity: int, timestamp: int):
- def processOrder(self, order: Order) -> List[Order]:
4. Example 1:
- Input: Order(1, "AAPL", 10, 100)
- Output: Confirmed Order: Order(1, "AAPL", 10, 100)
- Explanation: A valid buy order is placed and confirmed.
5. Example 2:
- Input: Order(2, "GOOG", 5, 50) (expired order is not processed)
- Output: []
- Explanation: The order has expired and is not confirmed.
6. Constraints:
- 0 < order_id <= 10^6
- 0 < quantity <= 1000
- timestamp is a positive integer designating the order time.
coding Medium dynamic programming #7

7. [Dynamic Programming] — Find the maximum earnings from stock transactions

Background: In the data analytics and processing domain, Databricks often deals with time series data that includes stock prices. Building systems to optimize stock trading can significantly enhance trading strategies.
Problem statement: You are tasked with finding the maximum earnings that can be achieved from a list of stock prices where you can buy and sell. You can complete as many transactions as you want, but you must sell the stock before you buy again. Given an array prices representing the prices of a stock on different days, return the maximum profit you can achieve.
Function/class signature:
  • def max_profit(prices: List[int]) -> int:

Example 1:
  • Input: prices = [7, 1, 5, 3, 6, 4]

  • Output: 7

  • Explanation: Buy on day 2 (price = 1) and sell on day 3 (price = 5), profit = 5-1 = 4. Then buy on day 4 (price = 3) and sell on day 5 (price = 6), profit = 6-3 = 3. Total profit is 4 + 3 = 7.

Example 2:
  • Input: prices = [1, 2, 3, 4, 5]

  • Output: 4

  • Explanation: Buy on day 1 (price = 1) and sell on day 5 (price = 5). Total profit is 5-1 = 4.

Constraints:
  • 0 <= prices.length <= 3 * 10^4

  • 0 <= prices[i] <= 10^4
coding Hard graph #8

8. Coding — Find the Shortest Path in a Directed Graph

Background: In Databricks, efficient data processing often involves navigating complex dependency graphs for job scheduling. Understanding how to find the shortest path in a directed graph can optimize such workflows.
Problem statement: Given a directed graph represented as an adjacency list, implement a function to find the shortest path from a starting node to a destination node. Each edge has a weight that represents the time taken to travel along that edge. If there is no path, return -1.
Function/class signature:
  • def shortest_path(graph: Dict[int, List[Tuple[int, int]]], start: int, destination: int) -> Union[int, List[int]]:


Example 1:
Input: graph = {0: [(1, 4), (2, 2)], 1: [(3, 1)], 2: [(1, 1), (3, 5)], 3: []}, start = 0, destination = 3
Output: 5
Explanation: The shortest path is 0 -> 2 -> 1 -> 3, which has a total weight of 5.
Example 2:
Input: graph = {0: [(1, 4), (2, 1)], 1: [(3, 1)], 2: [(1, 2), (3, 5)], 3: []}, start = 0, destination = 1
Output: 4
Constraints:
  • The number of nodes in the graph will be 1 <= len(graph) <= 100.

  • Each edge's weight is a positive integer not exceeding 10^3.

  • No cycles will be present in the graph.
coding Medium dynamic programming #9

9. [Dynamic Programming] — Maximum profit for stock transactions

Background: Databricks needs a robust system to manage stock trades efficiently as their software may provide analytics for stock markets. Utilizing dynamic programming can help in optimizing transaction strategies for maximum profits.
Problem statement: You are tasked to implement a function that determines the maximum profit that can be made from a series of stock transactions over a given number of days. Given an array prices where prices[i] is the price of a stock on the i-th day, you can complete as many transactions as you like (i.e., buy and sell multiple times) but you must sell the stock before you buy it again. Your goal is to calculate the maximum profit you can achieve.
Function/class signature:
  • def maxProfit(prices: List[int]) -> int:

Example 1:
Input: prices = [7, 1, 5, 3, 6, 4]
Output: 7
Explanation: Buy on day 2 (price = 1) and sell on day 3 (price = 5), profit = 5-1 = 4. Then buy on day 4 (price = 3) and sell on day 5 (price = 6), profit = 6-3 = 3. Total profit = 4 + 3 = 7.
Example 2:
Input: prices = [1, 2, 3, 4, 5]
Output: 4
Explanation: Buy on day 1 (price = 1) and sell on day 5 (price = 5), profit = 5-1 = 4.
Constraints:
  • 0 <= prices.length <= 30000

  • 0 <= prices[i] <= 10^4

Related Databricks Software Engineer interview prep

Start practicing Databricks questions

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

Get Started Free