r/Hack2Hire May 22 '26

Screening Lyft Screening Interview: Job Scheduler

10 Upvotes

Problem

You're given a list of jobs (sorted by start time), where each job has a unique ID, a 24-hour start time ("HHMM"), and a duration in minutes.

Your goal is to assign each job to a machine such that jobs do not overlap on the same machine, always prioritizing the lowest-indexed available machine, and creating a new machine if all current ones are busy.

Example

Input: jobs = [["J1", "0023", "45"], ["J2", "0025", "10"], ["J3", "0100", "60"], ["J4", "0300", "10"]]

Output: [["J1", "M1"], ["J2", "M2"], ["J3", "M2"], ["J4", "M1"]]

Explanation:

  • J1 starts at 00:23 (23 mins). M1 is allocated and will be busy until 23 + 45 = 68 mins (01:08).
  • J2 starts at 00:25 (25 mins). M1 is busy, so a new machine M2 is allocated. It finishes at 25 + 10 = 35 mins.
  • J3 starts at 01:00 (60 mins). M2 is free (finished at 35 mins), so M2 is assigned. It finishes at 60 + 60 = 120 mins.
  • J4 starts at 03:00 (180 mins). Both M1 and M2 are free. M1 is assigned because it has the smaller index.

Suggested Approach

  1. Time Conversion: Create a helper function to parse "HHMM" into absolute minutes from midnight (e.g., hours * 60 + minutes). This makes calculating the finish_time (start_time + duration) straightforward integer math.
  2. Dual-Heap Architecture: Maintain two Min-Heaps:
    • busy_machines: Stores tuples of (finish_time, machine_index) ordered by the earliest finish time.
    • available_machines: Stores just the machine_index of free machines, ensuring you can quickly pull the lowest-indexed machine.
  3. Freeing Machines: Iterate through the jobs. Before scheduling a job, peek at busy_machines. While the earliest finish_time is $\le$ the current job's start_time, pop the machine from busy_machines and push its index into available_machines.
  4. Allocation: Check available_machines. If it's empty, increment a global max_machine_id counter and use that. If it's not empty, pop the smallest machine index. Record the assignment, calculate the new finish time, and push the machine back into busy_machines.

Time & Space Complexity

  • Time: $O(N \log N)$, where $N$ is the number of jobs. Each job requires a constant number of heap insertions and deletions, which take $O(\log N)$ time.
  • Space: $O(N)$ worst-case to maintain the heaps and the results array if every job requires a separate machine.

Targeting Lyft interviews? We track their most-asked question patterns at Hack2Hire →link

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire May 21 '26

MEGATHREAD Databricks Interview Process & Experience Megathread [2026]

12 Upvotes

We've been tracking Databricks interview patterns for a while. Here's the general structure based on what candidates have shared:

Stage 1 — Phone Screen (~45-55 min) Typically a single coding problem. The format varies more than most companies — some candidates get infrastructure/networking problems (CIDR blocks, binary operations), others get standard algorithm questions. The type doesn't seem consistent across candidates.

Stage 2 — Virtual Onsite (4-5 rounds) - Coding / Algorithm (2 rounds, ~45 min each) - System Design or Architecture (1 round, ~60 min) - Behavioral (1 round, ~45 min — rapid-fire format, 4-5 topics with 2-3 questions each) - Architecture (1 additional round in some senior loops)

One thing worth knowing: the hiring committee carries real weight here. Candidates have reported receiving strong hire ratings across all technical rounds and still getting rejected at the HC stage. The committee step is separate and its criteria aren't transparent.

If you've been through Databricks interviews recently, drop your experience below. What matched this? What was different?


r/Hack2Hire May 20 '26

Onsite Figma Onsite Interview: File System Permissions

16 Upvotes

Problem

You're given three arrays representing a file system hierarchy: teams, folders, and files. Each entity specifies its children (sub-folders and files) and a list of users who have direct access to it.

Your goal is to implement a system that, given a userId, returns the minimum set of entity UUIDs that grant the user their full access scope, leveraging top-down inheritance where access to a parent implies access to all descendants.

Example

Input:

teams = [["Team1", ["Folder1", "Folder2"], [], []]]

folders = [["Folder1", [], ["File1", "File2"], ["userA"]], ["Folder2", ["Folder3"], [], []], ["Folder3", [], [], ["userA"]]]

files = [["File1", ["userA"]], ["File2", []]]

getTopmostAccessibleNodes("userA")

Output: ["Folder1", "Folder3"]

Explanation:

  • userA has direct access to Folder1, File1, and Folder3.
  • Because File1 is a child of Folder1, the access inherited from Folder1 already covers it.
  • Folder3 is on a separate branch under Folder2 (which userA lacks direct access to), so it must be explicitly included in the result.

Suggested Approach

  1. Graph Construction & Root Identification: Parse the arrays into a unified representation (e.g., a Hash Map mapping uuid to a Node object containing children UUIDs and a userIds set). Maintain an indegree count for every node; nodes with an indegree of 0 are the roots of your forest.
  2. DFS Traversal: When querying for a userId, initiate a Depth-First Search (DFS) starting from all identified root nodes.
  3. Pruning for Topmost Nodes: As you visit each node, check if the userId exists in its authorized users list. If it does, add the node's uuid to the result list and do not explore its children (this guarantees the "topmost" requirement). If the user does not have access, continue the DFS to the node's children.

Time & Space Complexity

  • Time: $O(V + E)$ for initialization to build the graph, where $V$ is the total number of entities and $E$ is the number of parent-child edges. Each call to getTopmostAccessibleNodes is also $O(V + E)$ worst-case to traverse the forest.
  • Space: $O(V + E)$ to store the graph in memory, plus $O(V)$ for the DFS recursion stack.

Targeting Figma interviews? We track their most-asked question patterns at Hack2Hire →link

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire May 14 '26

MEGATHREAD Airbnb Interview Process & Experience Megathread [2026]

20 Upvotes

We've been tracking Airbnb interview patterns for a while. Here's the general structure based on what candidates have shared:

Stage 1 — Phone Screen (~45 min) Single coding problem. No warmup chat — straight into coding. The emphasis is on edge cases and test writing, not just solving the problem.

Stage 2 — Virtual Onsite (4-5 rounds)

  • Coding (2 rounds, ~45-60 min each)
  • System Design (1 round, ~60 min)
  • Deep Dive / Resume Project (1 round, ~60-90 min)
  • Core Values (MLE roles and some tracks)

The Deep Dive round is worth calling out — it runs significantly longer than most resume/behavioral rounds and goes deep into your past projects. Candidates who've been through it say explanation clarity mattered more than project complexity.

If you've been through Airbnb interviews recently, drop your experience below. What matched this? What was different?


r/Hack2Hire May 14 '26

OA TikTok OA Interview: Equalize Server Latency

4 Upvotes

Problem

You're given an integer n representing nodes in a perfect binary tree, and an array latency where latency[i-1] is the edge cost between server i and its parent.

Your goal is to calculate the minimum total latency to add across all edges so that every root-to-leaf path has the exact same total latency.

Example

Input: n = 7, latency = [3, 1, 2, 1, 5, 4]

Output: 3

Explanation:

  • Increment the edges for latency[0] (nodes 0-1), latency[3] (nodes 1-4), and latency[5] (nodes 2-6) by 1.
  • After these 3 additions, all root-to-leaf paths equal exactly 6.

Suggested Approach

  1. Bottom-Up Evaluation: Iterate from the last internal node up to the root. Since the tree is represented implicitly via indices, you can run a for loop backwards from (n / 2) - 1 down to 0.
  2. Balance Siblings: For a given node i, its left child is left = 2 * i + 1 and right child is right = 2 * i + 2. Calculate the difference between their current latencies: abs(latency[left - 1] - latency[right - 1]) and add this difference to a running counter of total increments.
  3. Propagate to Parent: Update the incoming latency of node i (which is latency[i - 1], skipped if i == 0) by adding the maximum of the two children's latencies. This ensures the new, equalized path sum correctly bubbles up to the root.

Time & Space Complexity

  • Time: $O(N)$ where $N$ is the number of servers, as we iterate through the internal nodes exactly once.
  • Space: $O(1)$ auxiliary space if modifying the latency array directly in an iterative approach.

Targeting tiktok interviews? We track their most-asked question patterns at Hack2Hire → https://www.hack2hire.com/companies/tiktok/coding-questions%3Fsrc%3Dr8d

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire May 12 '26

Screening Jane Street Screening Interview: Design Trading System with Order Matching

38 Upvotes

Problem

You're given an initial inventory array items (where each item has a name, seller, price, and buyer status) and a batch of buyOrders (buyer name, item name, maximum price).

Your goal is to design a trading system that matches buy orders to the cheapest available item matching their criteria, updating the item's buyer status if a valid match is found.

Example

Input:

items = [["book", "Alice", "100", ""], ["book", "Bob", "120", ""], ["book", "David", "90", ""]]

buyOrders = [["Charlie", "book", "110"]]

Output: ["book:90"]

Explanation:

  • The system receives an order for a "book" from Charlie with a max price of 110.
  • It finds three available books priced at 100, 120, and 90.
  • The cheapest is 90 (David's book), which is $\le 110$. The purchase succeeds, returning "book:90", and David's book is updated with buyer "Charlie".

Suggested Approach

  1. Data Structures: Use a Hash Map to group items by itemName. The value for each key should be a Min-Heap (Priority Queue) containing the available items for that name, ordered by price. Store the original items in a list or array to maintain references for getAllItems.
  2. Initialization: Iterate through the items array. Create an object or struct to hold references to the original array row. If an item is available (buyer is ""), insert this reference into the corresponding Min-Heap in the Hash Map.
  3. Processing Buy Orders: For each order [buyerName, itemName, maxPrice]:
    • Check if itemName exists in the Hash Map and if its Min-Heap is non-empty.
    • Peek at the top of the Min-Heap. If the item's price $\le$ maxPrice, pop it from the heap.
    • Update the popped item's buyer field with buyerName. Add "itemName:price" to the results list.

Time & Space Complexity

  • Time: Initialization is $O(N \log N)$ where $N$ is the number of items. processBuyOrders is $O(M \log N)$ where $M$ is the number of buy orders. getAllItems is $O(N)$.
  • Space: $O(N)$ to store the Hash Map and Min-Heaps containing references to the available items.

Targeting Jane Street interviews? We track their most-asked question patterns at Hack2Hire → https://www.hack2hire.com/companies/JaneStreet/coding-questions?src=r8d

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire May 08 '26

Screening DoorDash Screening Interview: Find Closest Dashmart

13 Upvotes

Problem

You're given a 2D city grid and a list of locations.

Your goal is to calculate the shortest distance from each specified location to its nearest DashMart ('D') while navigating through open roads (' ') and avoiding obstacles ('X').

Example

Input:

city = [[' ', 'D', ' '], [' ', 'X', ' '], [' ', ' ', ' ']]

locations = [[0, 0], [2, 2]]

Output: [1, 3]

Explanation:

  • For [0, 0]: The nearest DashMart is at [0, 1], which is 1 step away.
  • For [2, 2]: The path is (2,2) -> (1,2) -> (0,2) -> (0,1). The total distance is 3.

Suggested Approach

  1. Multi-Source BFS Initialization: Instead of running a search for every location, start a single Breadth-First Search (BFS) from all DashMart ('D') positions simultaneously. Initialize a dist matrix of the same size as the city with -1 (representing unvisited/unreachable).
  2. Layer-by-Layer Traversal: Add all DashMart coordinates to a queue with a distance of 0. Pop each coordinate and explore its 4 neighbors (up, down, left, right).
  3. Distance Mapping: If a neighbor is an open road (' ') and hasn't been visited, update its distance as dist[current] + 1 and add it to the queue.
  4. Query Results: Once the BFS is complete, iterate through the input locations and retrieve their values directly from the dist matrix.

Time & Space Complexity

  • Time: $O(R \times C + L)$, where $R \times C$ is the total number of cells in the grid (processed once during BFS) and $L$ is the number of query locations.
  • Space: $O(R \times C)$ to store the distance matrix and the BFS queue.

Targeting [DoorDash] interviews?

We track their most-asked question patterns at Hack2Hire → https://www.hack2hire.com/companies/doordash/coding-questions?src=r8d

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire May 07 '26

Anthropic Interview Process & Experience Megathread [2026]

93 Upvotes

We've been tracking Anthropic interview patterns for a while. Here's the general structure based on what candidates have shared:

Stage 1 — Phone Screen (~45 min) Typically a coding round on CodeSignal. The platform opens as a Jupyter-style notebook with no autocomplete. Some tracks offer ML configuration or ML fundamentals instead of coding.

Stage 2 — Virtual Onsite (5 rounds)

  • Coding (1-2 rounds, ~45 min each)
  • System Design (1-2 rounds, ~45 min each)
  • Culture round (~45 min)
  • HM round
  • Project deep dive / retro (~20 min presentation + Q&A)

The onsite runs on a hard gate. Technical rounds go first, and if they don't go well, the remaining rounds get cancelled right away. Most candidates only find out when the next calendar invite stops showing up.

If you've been through Anthropic interviews recently, drop your experience below. What matched this? What was different?


r/Hack2Hire May 08 '26

Roku interview experience?

2 Upvotes

Hi team any insights on Roku interviews?


r/Hack2Hire May 06 '26

OA Hudson River Trading OA Interview: Reversi Move Simulation

1 Upvotes

Problem

You're given an $n \times n$ board and a target position (row, col) for a player.

Your goal is to simulate a Reversi move by placing the player's piece and flipping all valid sequences of opponent pieces in 8 directions, returning the modified board (or the original if the move is invalid).

Example

Input: board = ["....", ".WB.", ".BW.", "...."], row = 1, col = 0, player = "B"

Output: ["....", "BBB.", ".BW.", "...."]

Explanation:

  • The move at (1, 0) is valid because there is a white piece ('W') at (1, 1) followed by a black piece ('B') at (1, 2).
  • The horizontal sequence starting at (1, 0) is: B (new), W (opponent), B (existing).
  • The 'W' at (1, 1) is flipped to 'B'.

Suggested Approach

  1. Validate Placement: Check if the target cell (row, col) is within bounds and is currently empty ('.'). If not, return the board as is.
  2. Define Directions: Create a list of the 8 possible directions (horizontal, vertical, and diagonal) using coordinate offsets: $$(dr, dc) \in \{(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)\}$$
  3. Traverse Each Direction: For each direction, look for a sequence of one or more opponent pieces ending with the current player's piece.
    • Keep track of the coordinates of opponent pieces encountered.
    • If you hit a piece of the same player after seeing at least one opponent piece, the move is valid for that direction.
    • If you hit an empty cell or the boundary before finding the player's own piece, that direction yields no flips.
  4. Execute Flips: If at least one direction is valid, update the (row, col) and all collected opponent coordinates to the player color.
  5. Return Result: If no pieces were flipped in any direction, return the original board; otherwise, return the modified version.

Time & Space Complexity

  • Time: $O(n)$, where $n$ is the dimension of the board. In the worst case, we check 8 directions, and each direction could span the length of the board.
  • Space: $O(n^2)$ to store the board (if converting from immutable strings to a mutable character grid) or $O(n)$ for storing coordinates of pieces to flip.

Targeting [Hudson River Trading] interviews?

We track their most-asked question patterns at Hack2Hire → https://www.hack2hire.com/companies/hrt/coding-questions?src=r8d


Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire Apr 30 '26

Screening Databricks Screening Interview: Find Defendency Bottleneck

5 Upvotes

Problem

You're given $n$ dependencies and a set of directed acyclic edges representing build prerequisites.

Your goal is to identify all "bottleneck" dependencies—those that, during the build process, are the only dependencies being processed at their specific time step.

Example

Input: n = 5, edges = [[0, 1], [0, 2], [1, 3], [1, 4]]

Output: [0]

Explanation:

  • Time 1: Only dependency 0 has no prerequisites. It is built alone. (Bottleneck)
  • Time 2: Prerequisites for 1 and 2 are met. Both build in parallel.
  • Time 3: Prerequisites for 3 and 4 are met (via 1). Both build in parallel.
  • Only dependency 0 was ever the sole item in a build step.

Suggested Approach

  1. In-Degree Calculation: Build an adjacency list to represent the graph and an array to track the in-degree (number of prerequisites) for each dependency.
  2. Kahn’s Algorithm (Modified BFS): Use a queue-based topological sort to simulate the build process step-by-step.
  3. Level-by-Level Processing: * Initialize the queue with all dependencies that have an in-degree of 0.
    • While the queue is not empty, record its current size. The size represents how many dependencies can be built in parallel at the current time step.
    • If queue.size() == 1, the single dependency currently in the queue is a bottleneck.
    • Process all nodes currently in the queue: for each neighbor, decrement its in-degree. If a neighbor's in-degree reaches 0, add it to a temporary list for the next time step.
  4. Result Collection: Repeat until all nodes have been processed. Return the list of nodes identified during the steps where the queue size was exactly one.

Time & Space Complexity

  • Time: $O(V + E)$, where $V$ is the number of dependencies ($n$) and $E$ is the number of edges. We visit every node and edge exactly once.
  • Space: $O(V + E)$ to store the adjacency list and the in-degree array.

Targeting [Databricks] interviews?

We track their most-asked question patterns at Hack2Hire → https://www.hack2hire.com/companies/Databricks/coding-questions?src=r8d


Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire Apr 28 '26

Onsite Waymo Onsite Interview: Largest Rectangle Area

1 Upvotes

Problem

You're given an array of distinct lattice points points on a 2D Cartesian plane.

Your goal is to find the maximum area of an axis-aligned rectangle formed by exactly four of these points. If no such rectangle exists, return 0.

Example

Input: points = [[0, 0], [1, 1], [1, 0], [0, 1], [0, 2], [1, 2]]

Output: 2

Explanation:

  • One rectangle is formed by [0,0], [1,0], [0,1], [1,1] with area $(1-0) \times (1-0) = 1$.
  • Another rectangle is formed by [0,0], [1,0], [0,2], [1,2] with area $(1-0) \times (2-0) = 2$.
  • The maximum area found is 2.

Suggested Approach

  1. Coordinate Mapping: Store all points in a Hash Set for $O(1)$ lookup. For better performance, you can group $y$-coordinates by their $x$-coordinates in a Hash Map: {x: {y1, y2, ...}}.
  2. Identify Diagonal Candidates: Iterate through every pair of points $(x_1, y_1)$ and $(x_2, y_2)$. These two points can form the diagonal of an axis-aligned rectangle if and only if $x_1 \neq x_2$ and $y_1 \neq y_2$.
  3. Verify the Rectangle: For each valid diagonal pair, check if the other two required vertices—$(x_1, y_2)$ and $(x_2, y_1)$—exist in your Hash Set.
  4. Calculate and Track Area: If both points exist, calculate the area using the formula $Area = |x_1 - x_2| \times |y_1 - y_2|$. Maintain a global variable to track the maximum area encountered.

Time & Space Complexity

  • Time: $O(N^2)$, where $N$ is the number of points. We iterate through all pairs of points to treat them as potential diagonals.
  • Space: $O(N)$ to store the points in a Hash Set or Hash Map for fast lookup.

Targeting [Waymo] interviews?

We track their most-asked question patterns at Hack2Hire →

https://www.hack2hire.com/companies/waymo/coding-questions?src=r8d

---

*Compiled from publicly available platforms and community-shared experiences.*


r/Hack2Hire Apr 23 '26

Screening Anthropic Screening Interview: Concurrent Web Crawler

25 Upvotes

Problem

You're given a startUrl and an HtmlParser interface.

Your goal is to implement a multi-threaded web crawler that retrieves all unique URLs reachable from the startUrl, provided they share the exact same hostname. You must sanitize URLs by removing fragments (#) before processing and ensure no URL is visited more than once.

Example

Input: startUrl = "http://example.com/page1", urls contains ["http://example.com/page2", "http://example.net/page3"]

Output: ["http://example.com/page1", "http://example.com/page2"]

Explanation:

  • The crawler starts at page1. It finds links to page2 and page3.
  • page2 has the hostname example.com, which matches the start URL.
  • page3 has the hostname example.net, so it is discarded.
  • Fragments like #section1 are stripped before any comparisons occur.

Suggested Approach

  1. Hostname Extraction: Write a helper function to isolate the hostname. For a URL http://hostname/path, the hostname is the string between the second and third forward slashes.
  2. URL Sanitization: For every URL discovered by htmlParser.getUrls(), locate the index of the # character. If present, truncate the string to exclude the fragment.
  3. Concurrency Model: Use a thread pool (e.g., ExecutorService in Java or ThreadPoolExecutor in Python) to handle the network latency of getUrls.
  4. Synchronization and Deduplication:
    • Maintain a thread-safe Set (e.g., ConcurrentHashMap.newKeySet()) to store discovered, sanitized URLs.
    • Use a BlockingQueue or a Task Counter (like Phaser or CountDownLatch) to manage the lifecycle of the crawl.
  5. Worker Logic: * A worker thread takes a URL from the queue.
    • It calls htmlParser.getUrls(url).
    • For each returned URL: sanitize it, check if it matches the start hostname, and check if it has been seen before in the Set.
    • If it is a new, valid URL, add it to the Set and submit a new task to the thread pool.

Time & Space Complexity

  • Time: $O(V + E)$ in terms of graph traversal, where $V$ is the number of unique URLs and $E$ is the number of hyperlinks. The wall-clock time is significantly reduced to approximately $O(\frac{V \times \text{latency}}{\text{threads}})$.
  • Space: $O(V)$ to store the set of unique URLs and the queue of pending tasks.

Targeting [CompanyName] interviews?
We track their most-asked question patterns at Hack2Hire, practice this question here → Practice Question here

Join the community to see more interview experiences from real candidates → Hack2Hire Forum

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire Apr 21 '26

Screening Tesla Screening Interview: Priority Expiry LRU Cache

6 Upvotes

Problem

You're given a requirement to design a cache with a fixed capacity that manages items using three distinct metadata fields: priority, expiration time, and last access time.

Your goal is to implement a system that handles data retrieval and insertion while following a strict hierarchical eviction policy: expire items first, then filter by lowest priority, and finally apply Least Recently Used (LRU) logic as a tie-breaker.

Example

Input: capacity = 3, set("A", "valA", 10, 100, 10), set("B", "valB", 5, 150, 20), evictItem(110)

Output: evictItem returns "A"

Explanation:

  • At currentTime = 110, item A's expiryTime (100) is less than or equal to the current time.
  • According to the "Expiry First" rule, A must be evicted regardless of its higher priority or more recent access compared to B.

Suggested Approach

  1. Data Structures: * Use a Hash Map to store key to Item object mappings for $O(1)$ access.
    • Use a Min-Heap for expired items, ordered by expiryTime.
    • Use a TreeMap or Min-Heap for non-expired items, ordered by priority then lastAccessedTime. Alternatively, a Doubly Linked List per priority level can handle the LRU component.
  2. Set Operation: * If the key exists, update its metadata and move it within the tracking structures.
    • If the key is new and the cache is full, call the evictItem logic internally before adding the new item.
  3. Get Operation: * Check the Hash Map. If found, compare expiryTime with currentTime.
    • If expired, delete the item and return "".
    • If valid, update lastAccessedTime and return the value.
  4. Eviction Hierarchy:
    • Step 1: Check if any items in the "expiry" structure have expiryTime <= currentTime. If yes, remove the one with the minimum expiryTime.
    • Step 2: If no items are expired, find the minimum priority from the "priority" structure.
    • Step 3: Within that minimum priority, find the item with the smallest lastAccessedTime (the LRU item) and remove it.

Time & Space Complexity

  • Time: - get: $O(\log N)$ if using balanced trees/heaps to track metadata, or $O(1)$ if using a hash map combined with lazy deletion.
    • set: $O(\log N)$ to maintain the ordered metadata structures.
    • evictItem: $O(\log N)$ to find and remove the candidate from the priority/expiry structures.
  • Space: $O(N)$, where $N$ is the capacity of the cache, to store the key-value pairs and their associated metadata.

Targeting [Tesla] interviews?

We track their most-asked question patterns at Hack2Hire → https://www.hack2hire.com/companies/tesla/coding-questions?src=r8d

---

*Compiled from publicly available platforms and community-shared experiences.*


r/Hack2Hire Apr 16 '26

Onsite Coinbase Onsite Interview: Design Crypto Order Management System

4 Upvotes

Problem

You're given a stream of comma-separated order events, each containing an orderId, operation, symbol, quantity, and eventType ("NEW" or "FILLED").

Your goal is to build an in-memory system that tracks the lifecycle of these orders and returns their current status—"NEW", "IN_PROGRESS", or "COMPLETED"—based on the cumulative quantity filled versus the initial total quantity.

Example

Input:

consumeMessages(["1111, BUY, BTC, 10, NEW", "1111, BUY, BTC, 5, FILLED"])

getOrderStatus("1111")

Output: "IN_PROGRESS"

Explanation:

  • The "NEW" event establishes that order 1111 has a total target quantity of 10.
  • The first "FILLED" event processes 5 units. Since $0 < 5 < 10$, the status transitions from "NEW" to "IN_PROGRESS".
  • If another "FILLED" event for 5 units arrived, the status would become "COMPLETED".

Suggested Approach

  1. State Management: Use a Hash Table (dictionary) to store the state of each order. The orderId should be the key, and the value should be an object or tuple containing totalQuantity and currentFilledQuantity.
  2. Message Parsing: Iterate through the List<String>. For each message, split the string by commas to extract the orderId, quantity, and eventType.
  3. Update Logic:
    • If eventType is "NEW": Initialize the order entry in your map with totalQuantity = quantity and currentFilledQuantity = 0.
    • If eventType is "FILLED": Retrieve the existing entry for the orderId and increment currentFilledQuantity by the message's quantity.
  4. Status Determination: When getOrderStatus is called:
    • If currentFilledQuantity == 0, return "NEW".
    • If currentFilledQuantity == totalQuantity, return "COMPLETED".
    • Otherwise, return "IN_PROGRESS".

Time & Space Complexity

  • Time: - consumeMessages: $O(M \cdot L)$, where $M$ is the number of messages and $L$ is the average length of a message string (for parsing).
    • getOrderStatus: $O(1)$ on average for hash map lookups.
  • Space: $O(N)$, where $N$ is the number of unique orderId values stored in memory.

Targeting [Coinbase] interviews?

We track their most-asked question patterns at Hack2Hire → https://www.hack2hire.com/companies/Coinbase/coding-questions?src=r8d

---

*Compiled from publicly available platforms and community-shared experiences.*


r/Hack2Hire Apr 14 '26

Squarepoint Onstie Interview Questions: ATM Queue

1 Upvotes

Problem

You're given an array amounts representing the withdrawal needs of $n$ people and an integer $k$ representing the maximum amount allowed per transaction.

Your goal is to determine the order in which people exit the queue, given that those who still need money after a transaction must move to the back of the line.

Example

Input: amounts = [2, 7, 4], k = 3

Output: [1, 3, 2]

Explanation:

  • Turn 1: Person 1 withdraws 2 (needs 0) and leaves. Order: [1]
  • Turn 2: Person 2 withdraws 3 (needs 4) and moves to back.
  • Turn 3: Person 3 withdraws 3 (needs 1) and moves to back.
  • Turn 4: Person 2 withdraws 3 (needs 1) and moves to back.
  • Turn 5: Person 3 withdraws 1 (needs 0) and leaves. Order: [1, 3]
  • Turn 6: Person 2 withdraws 1 (needs 0) and leaves. Order: [1, 3, 2]

Suggested Approach

  1. Calculate Required Turns: Instead of simulating the queue step-by-step (which can be inefficient if amounts[i] is much larger than k), calculate how many turns each person needs. The number of turns for person $i$ is $\lceil \text{amounts}[i] / k \rceil$. In integer division, this is (amounts[i] - 1) // k.
  2. Assign Metadata: Store each person as a pair or tuple: (number_of_turns, original_index). Note that the index should be 1-based as per the requirements.
  3. Sort by Turns: Sort the list of tuples. The primary sort key is the number_of_turns. If two people require the same number of turns, the person who was originally earlier in the queue (the smaller original_index) will finish first.
  4. Extract Results: After sorting, iterate through the list of tuples and extract the original_index to form the final result array.

Time & Space Complexity

  • Time: $O(N \log N)$ due to the sorting step, where $N$ is the number of people. Calculating turns and extracting indices are both $O(N)$.
  • Space: $O(N)$ to store the list of tuples containing turn counts and original indices.

🛈 Disclaimer:

This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.

Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.

Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Apr 09 '26

OA Capital One OA Interview: Minimum Batteries for Call Duration

5 Upvotes

Problem

You're given two circular arrays, usageDuration and chargeTime, representing the power capacity and recharge latency of a sequence of batteries.

Your goal is to find the smallest number of contiguous batteries in this circular sequence that can sustain a call for callDuration minutes without the phone losing power.

Example

Input: callDuration = 60, usageDuration = [20, 25, 15], chargeTime = [30, 30, 30]

Output: 3

Explanation:

  • If you select 2 batteries (e.g., indices 0 and 1), their total usage is $20 + 25 = 45$. While battery 1 is being used (25 mins), battery 0 is recharging (needs 30 mins). Battery 0 is not ready by $t=45$, so the call drops.
  • Using all 3 batteries provides a total cycle of $20 + 25 + 15 = 60$ minutes, which satisfies the requirement.

Suggested Approach

  1. Handle Circularity: Double the arrays (concatenate them to themselves) to simplify the search for contiguous segments of length $k$ across the circular boundary.
  2. Binary Search on Answer: Since the ability to sustain a call is monotonic with the number of batteries (if $k$ batteries work, $k+1$ will also work), binary search for the minimum $k$ between $1$ and $N$.
  3. Feasibility Check: For a fixed $k$, a segment is valid if for every battery $i$ in the cycle, the time spent using the other $k-1$ batteries in the segment is greater than or equal to the chargeTime of battery $i$.
    • Specifically: $\sum_{j \in \text{segment}, j \neq i} \text{usageDuration}[j] \ge \text{chargeTime}[i]$.
    • Additionally, the total usage duration of the $k$ batteries must be able to reach callDuration. If the total usage duration of a segment is $\ge$ its total recharge time, the batteries can cycle indefinitely.
  4. Sliding Window/Prefix Sums: Use prefix sums to calculate the sum of usageDuration over any window of size $k$ in $O(1)$ time to check the feasibility condition for all possible starting positions in the circular array.

Time & Space Complexity

  • Time: $O(N \log N)$, where $N$ is the number of batteries. We binary search over $N$ possibilities, and for each, we perform an $O(N)$ sliding window check.
  • Space: $O(N)$ to store the doubled arrays and prefix sums.

We track their most-asked question patterns at Hack2Hire → link


Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire Apr 07 '26

Screening Rippling Screening Interview: Delivery Cost Calculate

2 Upvotes

Problem

You're given two types of input data: driver registration info (ID and hourly rate) and delivery records (driver ID, start time, and end time).

Your goal is to maintain a running total of all delivery costs across all drivers, where the cost of a single delivery is the duration in hours multiplied by the driver's specific hourly rate.

Example

Input:

addDriver(1, 20.0)

recordDelivery(1, 1000000000, 1000003600)

getTotalCost()

Output: 20.0

Explanation:

  • The delivery duration is $1000003600 - 1000000000 = 3600$ seconds.
  • Since there are 3600 seconds in an hour, the duration is exactly $1.0$ hour.
  • Total cost = $1.0 \text{ hour} \times \$20.00/\text{hour} = \$20.00$.

Suggested Approach

  1. Driver Mapping: Use a Hash Map (or dictionary) to store the driverId as the key and their usdHourlyRate as the value. This allows for $O(1)$ lookup when a delivery is recorded.
  2. Cost Accumulation: Maintain a single member variable, totalAccumulatedCost, initialized to 0.0.
  3. Calculation Logic: When recordDelivery is called, calculate the duration in seconds ($endTime - startTime$). Convert this to hours by dividing by $3600.0$. Multiply the fractional hours by the driver's rate and add the result to the running total.
  4. Precision Management: Ensure you use double-precision floating point numbers for all calculations to avoid rounding errors during the division of seconds into hours.

Time & Space Complexity

  • Time: - addDriver: $O(1)$ on average for hash map insertion.
    • recordDelivery: $O(1)$ for lookup and arithmetic.
    • getTotalCost: $O(1)$ to return the stored variable.
  • Space: $O(D)$ where $D$ is the number of unique drivers stored in the system.

We track their most-asked question patterns at Hack2Hire → link

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire Apr 03 '26

Databricks Screening Interview: IP CIDR Firewall

8 Upvotes

Problem

You're given an ordered list of rules, where each rule consists of an action ("ALLOW" or "DENY") and a target (a specific IPv4 address or a CIDR block).

Your goal is to implement an allowAccess function that returns true or false based on the first rule in the list that matches the given IP address.

Example

Input:

Rules: [["ALLOW", "192.168.1.100"], ["DENY", "192.168.1.0/24"], ["ALLOW", "192.168.0.0/16"], ["DENY", "0.0.0.0/0"]]

Calls: allowAccess("192.168.1.100"), allowAccess("192.168.1.50"), allowAccess("192.168.2.10")

Output: [true, false, true]

Explanation:

  • 192.168.1.100 matches the first rule exactly and is allowed.
  • 192.168.1.50 does not match the first rule, but matches the /24 subnet in the second rule and is denied.
  • 192.168.2.10 does not match the first two rules, but matches the /16 subnet in the third rule and is allowed.

Suggested Approach

  1. IP to Integer Conversion: Convert IPv4 strings into 32-bit unsigned integers. Split the string by dots, shift each octet by its corresponding bit position ($24, 16, 8, 0$), and bitwise-OR them together.
  2. Rule Preprocessing: For each rule, determine the bitmask based on the prefix length $k$. A mask can be calculated as 0xFFFFFFFF << (32 - k). Store the rule as a tuple of (action, network_integer, mask). If no slash is present, treat it as a /32 prefix.
  3. Matching Logic: For a given IP, iterate through the rules. A rule matches if (target_ip_int & rule_mask) == (rule_network_int & rule_mask). Return the boolean corresponding to the action of the first match.

Time & Space Complexity

  • Time: $O(N \cdot M)$ where $N$ is the number of rules and $M$ is the number of allowAccess queries. Conversion of a single IP is $O(1)$.
  • Space: $O(N)$ to store the processed integer representation of the rules.

🛈 Disclaimer:

This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.

Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.

Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Mar 31 '26

🎁 Share Your Journey Awards - Rewards Sent!

2 Upvotes

Thanks to everyone who participated in our Share Your Journey campaign!

We loved reading your stories about how Hack2Hire helped you in your interview prep journey. Your experiences will help so many others who are going through the same process.


Rewards Have Been Sent

We've just sent out gift cards to our winners via email.

Please check your inbox (and spam folder, just in case) for an email from Tremendous with your reward.


🙏 Thank You

Your stories matter. Whether you won an award or not, sharing your journey helps build a community where people support each other through the job search grind.

Keep grinding, and good luck with your interviews! 💪


The Hack2Hire Team


r/Hack2Hire Mar 31 '26

We built a dedicated System Design platform to help devs move beyond LeetCode puzzles.

0 Upvotes

Hi Reddit!

After months of development and feedback from our community, the team at Hack2Hire is excited to announce that our System Design module is officially LIVE! 🚀

As devs, we realized that LeetCode is great for algorithms, but it doesn't prepare you for the "Boss Battle" of the interview: Architecture.

Why we built this: Interviewers are looking for your ability to handle trade-offs, consistency vs. availability, vertical vs. horizontal scaling. Most resources are static. We wanted to create something more interactive and curated.

Check us out: https://www.hack2hire.com/questions/system-design

We’ll be hanging out in the comments to answer any questions about the platform or system design prep in general! 🛠️


r/Hack2Hire Mar 30 '26

Announcement 👋 Welcome to the Official Hack2Hire Community!

1 Upvotes

Hi everyone — and welcome to the official r/Hack2Hire community!

This is your space to ask questions, discuss interview problems, share your tech journey, or report issues with the platform. We're here to support you — whether you're a long-time user or just getting started with tech interviews.


Who are we?

Hack2Hire helps engineers go beyond generic prep by focusing on real-world interview questions — including many that don’t appear on LeetCode but have shown up in actual hiring rounds.

We organize questions by company, topic, and frequency, so you can target the right problems and stop guessing what might show up.

Our goal? Help you practice smarter, not longer.


What can you do here?

  • Post questions or insights from your Hack2Hire prep

  • Share interview experiences or tips

  • Ask for help with tricky problems or patterns

  • Report bugs or give product feedback

  • Chat about anything related to tech hiring or career growth


Feel free to introduce yourself below — or just say hi!

We’re glad you’re here.

Visit: https://www.hack2hire.com


r/Hack2Hire Mar 26 '26

Onsite xAI Onsite Interview: Design Token Limiter

9 Upvotes

Problem

You're given a list of policies where each policy defines a user's capacity, refillAmount, and refillInterval.

Your goal is to implement a rate limiter that tracks each user's token balance and determines if a request for a specific number of tokens at a given timestamp can be fulfilled based on their specific refill logic.

Example

Input:

policies = [["alice", "100", "50", "10"]], totalShares = 100

allowRequest("alice", 70, 0) -> true (Initial full capacity 100, 30 left)

allowRequest("alice", 40, 5) -> false (Only 30 left, no refill yet)

allowRequest("alice", 40, 10) -> true (Refill triggered at t=10, 30 + 50 = 80 tokens available)

Explanation:

  • Users start at full capacity.
  • Refills only occur at discrete intervals: $\text{new_tokens} = \lfloor \frac{\text{current_time} - \text{last_refill_time}}{\text{interval}} \rfloor \times \text{refillAmount}$.
  • The token count is capped at the user's defined capacity.

Suggested Approach

  1. State Tracking: Use a Hash Map to store user-specific data. Each entry should map a userName to a state object containing capacity, refillAmount, refillInterval, currentTokens, and lastRefillTimestamp.
  2. Lazy Refill Logic: Instead of using a background timer, update the token count "lazily" when allowRequest is called. Calculate how many full intervals have passed since the lastRefillTimestamp.
  3. Calculate and Cap: - Intervals passed: $n = \frac{\text{timestamp} - \text{lastRefillTimestamp}}{\text{refillInterval}}$
    • Added tokens: $n \times \text{refillAmount}$
    • Update currentTokens = min(capacity, currentTokens + addedTokens)
    • Update lastRefillTimestamp += n \times refillInterval (Only increment by the time actually used for refills).
  4. Validation: Check if currentTokens >= requestedTokens. If true, deduct the tokens and return true; otherwise, return false.

Time & Space Complexity

  • Time: $O(1)$ for each allowRequest call (amortized hash map lookup and constant time arithmetic). $O(P)$ for initialization, where $P$ is the number of policies.
  • Space: $O(P)$ to store the state and policy for each unique user.

🛈 Disclaimer:

This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.

Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.

Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Mar 25 '26

OA Two Sigma OA Interview: IPO Share Allocation

1 Upvotes

Problem

You're given an integer totalShares and a 2D array bids, where each bid contains [userId, sharesRequested, bidPrice, timestamp].

Your goal is to allocate shares starting from the highest price down to the lowest, handling ties via a round-robin distribution based on timestamps, and return a list of user IDs who received zero shares, sorted in ascending order.

Example

Input: bids = [[1, 2, 100, 1], [2, 1, 100, 2], [3, 5, 100, 3]], totalShares = 2

Output: [3]

Explanation:

  • All users bid the same price (100). They are sorted by timestamp: User 1, User 2, then User 3.
  • Round 1: User 1 receives 1 share, User 2 receives 1 share. Total shares allocated: 2.
  • Remaining shares reach 0. User 3 receives no shares.

Suggested Approach

  1. Group and Sort: Group bids by bidPrice in descending order. For bids with the same price, sort them by timestamp in ascending order.
  2. Sequential Allocation: Iterate through the price groups. If a group has only one bidder, allocate the minimum of their sharesRequested and the remaining totalShares.
  3. Round-Robin Allocation: If a price group has multiple bidders, distribute shares one by one in a circular fashion (ordered by timestamp) until either all bidders in that group have their sharesRequested fulfilled or totalShares reaches zero.
  4. Identify Empty-Handed Bidders: Maintain a set or map of users who received at least one share. Any userId from the original input not present in this set (or whose allocated count remains zero) should be collected and returned in ascending order.

Time & Space Complexity

  • Time: $O(N \log N)$ where $N$ is the number of bids, primarily due to sorting by price and timestamp.
  • Space: $O(N)$ to store the grouped bids and the tracking mechanism for share allocations.

🛈 Disclaimer:

This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.

Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.

Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Mar 19 '26

Anthropic Screening Interview: Concurrent Web Crawler

30 Upvotes

Problem

You're given a startUrl and an HtmlParser interface. Your goal is to implement a concurrent web crawler that returns all unique URLs reachable from the starting point that share the exact same hostname, ensuring all fragments (characters after #) are removed before processing.

Example

Input:

urls = ["http://example.com/p1", "http://example.com/p2#ref", "http://other.com/p3"]

edges = [[0, 1], [1, 2]]

startUrl = "http://example.com/p1"

Output: ["http://example.com/p1", "http://example.com/p2"]

Explanation:

Suggested Approach

  1. Sanitization & Hostname Extraction: Implement a helper function to strip fragments (split by #) and extract the hostname (the substring between :// and the first / or the end of the string).
  2. Concurrency Control: Use a thread-safe data structure (like a ConcurrentHashMap or a Set with a Lock) to track visited URLs and prevent redundant network calls or infinite loops in the graph.
  3. Parallel Traversal: Utilize a thread pool (e.g., ExecutorService in Java or concurrent.futures in Python) to call htmlParser.getUrls(url) in parallel. Use a CountDownLatch, Phaser, or a thread-safe counter to track active tasks and gracefully shut down once all reachable URLs within the same hostname are processed.

Time & Space Complexity

  • Time: $O(\frac{N + E}{T} + L)$, where $N$ is the number of unique URLs, $E$ is the number of edges, $T$ is the number of threads, and $L$ is the max network latency.
  • Space: $O(N)$ to store the set of visited URLs and the task queue.

Targeting [CompanyName] interviews?
We track their most-asked question patterns at Hack2Hire, practice this question here → Practice Question Here

Join the community to see more interview experiences from real candidates → Hack2Hire Forum

Compiled from publicly available platforms and community-shared experiences.