Doordash Coding & Algorithms Interview Questions
Practice the exact questions companies are asking right now.
Determine equality after limited swaps
Question LeetCode 1790. Check if One String Swap Can Make Strings Equal Follow-up: Given two strings, determine if they can become anagrams of each ot...
Count changed nodes in N-ary trees
Question Given two N-ary trees (old and new versions) where each node has a key (string), value (int), and list of children, compute how many nodes ar...
Find names similar by one swap
Question LeetCode 859. Buddy Strings – Given a target string and a list of strings, return all list entries that can match the target by swapping at m...
Implement string-path file system operations
Question LeetCode 1166. Design File System – extended to support Create(path, value), Get(path), Set(path, value) and Delete(path) with validation rul...
Compute courier pay and implement load balancing
Problem 1: Compute courier (delivery driver) pay You are given a sequence of delivery-related events for a courier during a day. Your task is to compu...
Compute cart total with best promotion
Assume you are implementing a checkout price calculator for an online shopping cart. You are given: - A list of items in the cart. Each item has: - ...
Find longest common ordered restaurant list
You have two delivery drivers who each have a pickup plan represented as a list of restaurant IDs (strings). Because there is only one car, the combin...
Find closest value to a target in a BST
Problem Given the root of a binary search tree (BST) and a floating-point number target, return the value in the BST that is closest to target. If the...
Implement minimum window substring with counts
Implement min_window_with_counts(s, t) Task Write a function: - min_window_with_counts(s: str, t: str) -> tuple[int, int] that returns the inclusive (...
Compute Differences Between Catalog Trees
You are given two rooted catalog trees. Each node has a unique string key among its siblings and an associated value. Compare the two trees and return...
Implement string pattern matching
Implement a function that finds the first occurrence of a pattern P in a text T and returns the starting index (or -1 if not found). Follow-ups: compa...
Implement dasher active-time calculator
Implement a function that, given a dasherId, a local pay-period interval [startLocalDateTime, endLocalDateTime), and a list of order events of the for...
Generate the next lexicographic ordering
Given an array of integers, rearrange the elements in-place to form the next sequence in lexicographic order relative to the current arrangement; if n...
Find the nearest city sharing axis
You are given N cities, each with a unique name and integer coordinates (x, y). For any query city, return the nearest city that shares either the sam...
Implement and compare round-robin and consistent hashing
Implement a round-robin load balancer that selects among service nodes, skipping unavailable nodes and wrapping around correctly. Fix typical pitfalls...
Find nearest courier for each customer
Given two sets of 2D points: customers C = {c1..cn} and active couriers D = {d1..dm}, return for every customer the nearest courier by geographic dist...
Debug using logs and allocate tasks
You inherit a service where unit tests pass locally, but production logs show intermittent errors. Without a debugger, outline a step-by-step debuggin...
Design dasher-to-order assignment algorithm
You are building a real-time 'dasher picker' that assigns delivery drivers (Dashers) to incoming orders. Define objective(s) (e.g., minimize ETA and c...
Implement round-robin load balancer
Implement a load balancer that distributes incoming requests across N backend servers in strict round-robin order. Requirements: ( 1) Support addServe...
Compute delivery times on a grid
You are given a 2D grid with cells marked as 'M' (warehouses), 'C' (customers), 'X' (obstacles), and '.' (roads). You can move up, down, left, or righ...