Databricks software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
10.0.0.1. A CIDR block is written as base_ip/k, which...Input: Listn 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 treeSnapshotSet that supports adding and removing integers, membership checks, and capturing immutable snapshots of the...Input: ListSystem Design Questions - Databricks These are commonly asked system design questions from Databricks interviews. Updated March 2026.
Input: Linked listid, timestamp, workspace, user, and units. Timestamps are integer seconds and units are positive integers encoded as strings.id. Return decisions in the original input order.REQUEST_MAX: a submission may request at most 6 units.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.REQUEST_MAX followed by WORKSPACE_60S. Do not stop after the first failure.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.{
"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"}
]
}[
{"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"]}
]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 quotasevaluate_admission_detailed(records: list[dict[str, str]], extra_rules: list[dict[str, str]]), retaining both Part 1 rules.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.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.rule, scope, used, proposed, and limit. used is the counted admission weight before this submission and proposed = used + units.[id] and used = 0. Workspace scopes use [workspace]; user scopes use [workspace, user]. All numeric diagnostic values are JSON integers.rule_id order. Output only failed rules.{
"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"}
]
}[
{"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":[]}
]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:{
"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"}
]
}[
{"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":[]}
]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:"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 signatureevaluate_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.{
"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"]
}[
{"action": "DENY", "rule_index": 0},
{"action": "ALLOW", "rule_index": 2},
{"action": "DENY", "rule_index": -1},
{"action": "DENY", "rule_index": 0}
]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:{
"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"]
}[
{"action": "ALLOW", "rule_index": 1},
{"action": "ALLOW", "rule_index": 1},
{"action": "DENY", "rule_index": 0},
{"action": "DENY", "rule_index": 2}
]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.0 through 32."ALLOW" or "DENY"; rules may overlap or be duplicates.[0, 2^32 - 1]; an exclusive interval endpoint may equal 2^32.void processOrder(Order order) and return a list of confirmed orders.class Order: def __init__(self, order_id: int, stock_symbol: str, quantity: int, timestamp: int): def processOrder(self, order: Order) -> List[Order]: Order(1, "AAPL", 10, 100) Confirmed Order: Order(1, "AAPL", 10, 100) Order(2, "GOOG", 5, 50) (expired order is not processed) [] 0 < order_id <= 10^6 0 < quantity <= 1000 timestamp is a positive integer designating the order time.-1.def shortest_path(graph: Dict[int, List[Tuple[int, int]]], start: int, destination: int) -> Union[int, List[int]]:graph = {0: [(1, 4), (2, 2)], 1: [(3, 1)], 2: [(1, 1), (3, 5)], 3: []}, start = 0, destination = 3 5 0 -> 2 -> 1 -> 3, which has a total weight of 5.Example 2: graph = {0: [(1, 4), (2, 1)], 1: [(3, 1)], 2: [(1, 2), (3, 5)], 3: []}, start = 0, destination = 1 4 Constraints: 1 <= len(graph) <= 100. 10^3. Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free