Databricks Interview Questions
Practice the exact questions companies are asking right now.
Design a single-node persistent in-memory cache
Scenario Design a single-machine cache used by a web service to handle read/write requests. The cache should: - Store key/value pairs in memory (fast ...
Find path in implicit Fibonacci tree
You are given a special family of binary trees called Fibonacci trees. The k‑th order Fibonacci tree T(k) is defined recursively: - T(1) is a single n...
Implement streaming RLE and bit-packed codec
You are implementing a simple compression scheme for sequences of 32‑bit signed integers. The codec should support two encoding strategies: 1. Run‑Len...
Design KV store with sliding-window average QPS
Problem Design an in-memory key–value store that supports mutation operations and can report the average QPS (queries per second) over a recent time w...
Evaluate ACL rules for IP and CIDR
Problem You are implementing an IPv4 access-control list (ACL). The ACL contains ordered rules; each rule has: - action: either ALLOW or DENY - cidr: ...
Find path between nodes in Fibonacci tree
You are given a recursively defined Fibonacci tree F(k): - F(0) is a single node. - F(1) is a single node. - For k >= 2, F(k) consists of: - a root ...
Optimize a SQL query plan tree
Problem You are given an in-memory representation of a SQL query plan as a tree of nodes (a relational algebra plan). Each node is one of: - Scan(tabl...
Implement a rate-limited hit counter
You are designing a hit counter that records the number of hits received in the past 5 minutes. Implement a class HitCounter with the following method...
Design CRUD APIs with async jobs
Scenario Design a small backend service that manages a core entity with CRUD operations and also supports an asynchronous background job triggered by ...
Implement run-length encoding and decoding
You are given a string consisting of lowercase English letters. You need to implement run-length encoding (RLE) and its corresponding decoding. 1. Enc...
Check if CIDR is fully canceled by rules
You are given: - A target CIDR block T as a string, e.g. "10.0.0.0/16". - A list of rule CIDR blocks. Each rule has: - A type: either "allow" or "de...
Design a digital game shop backend
Design the backend for a simple digital game shop where users can buy virtual items (e.g., games, in‑game currency, skins) using credits in their acco...
Design a multithreaded event logger
Design a multithreaded in-memory event logger for a server application. Requirements: - Many worker threads running in the process need to log events ...
Implement firewall matching with CIDR rules
Implement a simple IPv4 firewall rule matcher. Problem You are given an ordered list of firewall rules. Each rule has: - an action: ALLOW or DENY - a ...
Design Tic-Tac-Toe and QPS data structures
You are given two independent coding problems that focus on data structure and API design. --- Problem 1: Generalized Tic-Tac-Toe Game with Simple AI ...
Find all anagram start indices
Problem Given two strings s and p, return all starting indices of substrings in s that are anagrams (permutations) of p. Input - s: string - p: string...
Find optimal commute mode in a city graph
You are designing a route planner that suggests the best way to commute between two points in a city using different transportation modes. The city is...
Implement a Tic-Tac-Toe game API
Problem Design and implement a Tic-Tac-Toe game class that supports playing moves on an n x n board. Requirements - Two players, represented by intege...
Design a Slack-like messaging system
Design a Slack-like real-time team messaging system. Requirements: - Users can: - Create and join workspaces. - Create public and private channels...
Implement RLE and bit-packing compression
You are asked to implement two related compression/decompression schemes: Run-Length Encoding (RLE) and bit-packing. --- Part 1 — Run-Length Encoding ...