Databricks algorithms (two rounds) interview

Round 5 of 8 · 23 questions reported

See the whole loop
Length
60 min
Format
Live coding in CoderPad or similar
They grade
Data structures and algorithms with attention to optimization

Questions Databricks asks in this round 23

  • Generalized tic-tac-toe with k in a rowCodingDesign a two-player Tic-Tac-Toe game on a board with n rows and m columns. A player wins by placing k of their own marks consecutively in one line: horizontal, vertical, diagonal…
    Last asked Sep 2026
  • Durable event log writer shared by thousands of threadsCodingMany threads on one server append small opaque records to a single durable log. Design and partly build the writer: how callers hand off records, how writes are batched and…
    Last asked Sep 2026
  • Fastest single-mode commute on a city gridCodingYou are planning a commute across a city drawn as a 2D grid of characters: - 'S': your starting point (exactly one). - 'D': your destination (exactly one). - '1' to 'k': a block…
    Last asked Sep 2026
  • Key-value store that reports its recent request rateCodingBuild an in-memory key-value store with put and get (delete optional). It must also report how many puts and gets per second it served over a recent stretch of time, say five…
    Last asked Sep 2026
  • Ordered IP firewall with CIDR rulesCodingImplement an IPv4 firewall that checks addresses against an ordered list of rules. Each rule is a pair (action, target). action is "ALLOW" or "DENY". target is either a single…
    Last asked Sep 2026
  • Customer revenue with referral credit and bottom-k queryCodingBuild an in-memory system that tracks how much revenue each customer brings in, including revenue from the customers they referred. Customers get integer ids starting at 0, in the…
    Last asked Sep 2026
  • Minimum-cost encryption of a directory treeCodingA storage service keeps a filesystem as a tree: Compliance requires every file in the tree to end up encrypted. You can issue two kinds of calls: - encrypt(filepath)
    Last asked Sep 2026
  • Path between two nodes of an implicit Fibonacci treeCodingA Fibonacci tree of order k is a binary tree defined recursively: - Orders 0 and 1 are a single node. - For k = 2, the root's left subtree is a Fibonacci tree of order k - 2 and…
    Last asked Sep 2026
  • Hybrid run-length and bit-packing codecCodingDesign an encoder and a decoder for a list of non-negative integers. The encoder compresses the list into a list of human-readable run strings. The decoder restores the original…
    Last asked Aug 2026
  • Lazy array with deferred map and indexOfCodingImplement LazyArray, an integer array that supports deferred mapping. Calls to map are recorded but do not run. The recorded functions run only when a query needs a value…
    Last asked Apr 2026
  • First position of any anagram of a pattern in a stringCodingReturn the smallest index at which some rearrangement of a query string appears as a contiguous substring of a text, or -1. Keep a running character count over a fixed-size window…
    Last asked Sep 2026
  • Linear regression with hand-written gradient descentCodingFit a one-feature linear regression by gradient descent on mean squared error, without an ML library. Then discuss choosing the learning rate, when to stop, and how to spot a…
    Last asked Sep 2026
  • Remove one point from a cover of integer intervalsCodingYou are given a list of non-overlapping half-open intervals. An interval start, end with start < end covers the integers start, start + 1, ..., end - 1. Reading the intervals in…
    Last asked Aug 2026
  • Rewrite a SQL query plan treeCodingA query plan is a tree of scan, filter, project and join nodes. Write rewrite rules that make it cheaper, such as moving a filter beneath a join, while the new plan still returns…
    Last asked Sep 2026
  • Primary and secondary circuit breakers with failoverCodingA service reads from a primary backend and can fail over to a secondary backend (for example a leader database and a follower). Put a circuit breaker in front of each backend so…
    Last asked Aug 2026
  • IP range to CIDR blocksCodingGiven a starting IPv4 address and a count n, return the shortest list of CIDR blocks that covers exactly the n consecutive addresses starting there, and no address outside that…
    Last asked Jan 2026
  • Thread-safe single-machine chat server with channelsCodingBuild an in-process chat system where many clients join channels and post messages that the other members receive. Make it correct under concurrent senders and receivers, and…
    Last asked Oct 2025
  • Drop a Tetris piece and clear full rowsCodingImplement a single step of a Tetris-like game. You get three inputs: - background: an H x W grid of 0/1. 1 is an occupied cell, 0 is empty. Row 0 is the top. - block: an h x w…
  • Find bottleneck dependencies in a parallel buildCodingYou are given n build targets numbered 0 to n - 1 and a list of directed edges edges. An edge u, v means target v cannot start building until target u has finished. The graph has…