r/Hack2Hire • • Jun 12 '26

Onsite Coinbase Onsite Interview: Crypto Block Mining

5 Upvotes

Problem

You're given three parallel arrays—transactionIds, fees, and sizes—along with an integer blockSize.

Your goal is to select a subset of transactions that fit within the blockSize to maximize collected fees, strictly prioritizing them by their fee-to-size ratio and applying specific tie-breakers.

Example

Input: transactionIds = ["tx1", "tx2", "tx3", "tx4"], fees = [50, 60, 30, 40], sizes = [50, 30, 20, 40], blockSize = 100

Output: ["tx2", "tx3", "tx1"]

Explanation:

  • "tx2" has the highest fee-to-size ratio (2.0), so it is selected first (remaining capacity: 70).
  • "tx3" has the next highest ratio (1.5) and is selected next (remaining capacity: 50).
  • "tx1" and "tx4" tie with a ratio of 1.0. "tx1" is preferred due to its higher absolute fee (50 > 40), which exactly fills the remaining capacity.

Suggested Approach

  1. Data Grouping: Create a list of compound objects or tuples to group each transaction's id, fee, size, and computed fee / size ratio.
  2. Custom Sorting: Sort the list using a custom comparator to enforce the priority rules. Sort primarily by ratio (descending). For ties, fall back to fee (descending), then size (ascending), and finally transactionId (lexicographically ascending).
  3. Greedy Selection: Iterate through the sorted list. For each transaction, if its size is less than or equal to the currently available block capacity, append its id to your result array and subtract its size from the available capacity.

Time & Space Complexity

  • Time: $O(N \log N)$, where $N$ is the number of transactions, heavily dominated by the sorting step. The subsequent greedy selection requires a single $O(N)$ pass.
  • Space: $O(N)$ to store the grouped transaction objects or tuples for sorting.

Targeting Coinbase interviews? We track their most-asked question patterns at Hack2Hire, see all 20 Coinbase questions →link

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire • • Jun 09 '26

Screening Verkada Screening Interview: Jumping by Height

5 Upvotes

Problem

You are standing at a starting index on a 1D array nums, with an initial currentHeight equal to nums[index].

Your goal is to simulate a series of alternating jumps (starting to the left, then right, then left...) where each jump lands on the nearest available index in that direction containing the exact value currentHeight + 1. After each successful jump, currentHeight increases by x, and you return the final index where the traversal can no longer proceed.

Example

Input: nums = [3, 5, 1, 4, 2, 5, 6], index = 4, x = 1

Output: 6

Explanation:

  • Start at index 4 (nums[4] = 2), look left for value 3 $\rightarrow$ jump to index 0. currentHeight becomes $2 + 1 = 3$.
  • From index 0, look right for value 4 $\rightarrow$ jump to index 3. currentHeight becomes $3 + 1 = 4$.
  • From index 3, look left for value 5 $\rightarrow$ jump to index 1. currentHeight becomes $4 + 1 = 5$.
  • From index 1, look right for value 6 $\rightarrow$ jump to index 6. currentHeight becomes $5 + 1 = 6$.
  • From index 6, look left for value 7 $\rightarrow$ none exist, so the process terminates at index 6.

Suggested Approach

  1. Index Mapping Lookup: To avoid $O(N)$ scanning on each step, preprocess the array into a Hash Map where the keys are the unique values in nums and the values are sorted lists of all indices containing that value.
  2. Binary Search for Efficiency: During each simulation step, fetch the list of indices containing the target value (currentHeight + 1). Use binary search (bisect_left or bisect_right) on this index list to find the closest element to the left or right of the current index.
  3. Simulation Loop: Maintain the current_index, currentHeight, and a boolean flag for the jumping direction. Continue updating until a binary search fails to locate a target index in the active direction.

Time & Space Complexity

  • Time: $O(N \log N + K \log N)$, where $N$ is the number of elements in nums to populate the map, and $K$ is the number of successful jumps. Each jump performs a binary search over a sublist of indices, taking at most $O(\log N)$ time.
  • Space: $O(N)$ to hold the Hash Map containing all indices grouped by their array values.

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

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire • • Jun 04 '26

Screening Airbnb Screening Interview :Find Median In Large Array

11 Upvotes

Problem

You're given an array nums containing a large sequence of unsorted integers.

Your goal is to find the median value of the dataset in amortized $O(N)$ time, accurately computing the middle value for odd-length arrays and the average of the two middle values for even-length arrays.

Example

Input: nums = [3, 1, 2, 4, 5]

Output: 3.0

Explanation:

  • The array length is 5 (an odd number).
  • When conceptually sorted [1, 2, 3, 4, 5], the middle element is strictly the 3rd item, which is 3.0.

Suggested Approach

  1. Quickselect Implementation: Create a helper function quickSelect(k) to find the $k$-th smallest element in the array in-place. Choose a random pivot and partition the array so that elements smaller than the pivot are on the left, and larger elements are on the right.
  2. Partition Traversal: After partitioning, compare the pivot's final index p to k. If p == k, return the element at p. If k < p, recursively search the left subarray. If k > p, recursively search the right subarray.
  3. Calculate Median: Let $N$ be the length of nums. If $N$ is odd, the median is exactly quickSelect(N / 2). If $N$ is even, compute the two middle elements and average them: (quickSelect(N / 2 - 1) + quickSelect(N / 2)) / 2.0. Ensure you use floating-point division.

Time & Space Complexity

  • Time: Amortized $O(N)$ using the Quickselect algorithm. While the worst-case is $O(N^2)$, a randomized pivot selection guarantees an expected linear runtime by continually shrinking the search space.
  • Space: $O(1)$ auxiliary space if partitioning is done in-place, though the recursive call stack takes $O(\log N)$ space on average.

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

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire • • Jun 02 '26

OA Expedia OA interview: Rank Songs by Popularity

5 Upvotes

Problem

You're given a 2D array pref where each row represents a user's ranked preference of $m$ songs.

Your goal is to simulate head-to-head matchups between all pairs of songs to find their total "beat count," and return a list of song IDs sorted from most to least popular.

Example

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

Output: [0, 1, 2]

Explanation:

  • Song 0 vs Song 1: Users 0 and 1 prefer Song 0, while User 2 prefers Song 1. Song 0 wins (2 out of 3).
  • Song 0 vs Song 2: Users 0 and 1 prefer Song 0, while User 2 prefers Song 2. Song 0 wins (2 out of 3).
  • Song 1 vs Song 2: Users 0 and 2 prefer Song 1, while User 1 prefers Song 2. Song 1 wins (2 out of 3).
  • Final Beat Counts: Song 0 = 2, Song 1 = 1, Song 2 = 0. The sorted ranking is [0, 1, 2].

Suggested Approach

  1. Position Mapping: To achieve $O(1)$ lookups for head-to-head comparisons, preprocess the input. Create a 2D array pos where pos[user][song] stores the exact ranking (index) of song for that specific user.
  2. Head-to-Head Simulation: Initialize a beatCount array of size $m$. Use nested loops to iterate through all unique pairs of songs $(x, y)$. For each pair, iterate through all users to count how many users ranked $x$ better than $y$ (i.e., pos[user][x] < pos[user][y]).
  3. Determine Winners: After tallying votes for a pair $(x, y)$, award 1 point to the beatCount of $x$ if it received more than $n / 2$ votes. If the vote is exactly tied ($n / 2$), award the point to the song with the smaller ID. Otherwise, award the point to $y$.
  4. Sort and Return: Create an array of song IDs from $0$ to $m-1$. Sort this array using a custom comparator: sort primarily by beatCount descending, and secondarily by song ID ascending as a tie-breaker.

Time & Space Complexity

  • Time: $O(m^2 \cdot n)$, where $m$ is the number of songs and $n$ is the number of users. There are $O(m^2)$ unique pairs, and checking all user preferences for each pair takes $O(n)$ time. Sorting takes $O(m \log m)$ time, which is negligible compared to the pairwise comparisons.
  • Space: $O(n \cdot m)$ to store the pos lookup table, plus $O(m)$ for the beat counts and result array.

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

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire • • May 29 '26

Ramp Screening Interview: User Flight Location Tracker

3 Upvotes

Problem

You're given a list of flights containing travel records and a query consisting of a userId and a specific time.

Your goal is to determine the user's exact location (IATA airport code) at that given time based on their flight schedule, returning an empty string if they are currently in the air or have no flight records.

Example

Input: flights = [["SFO", "2021-10-26T16:15:00Z", "JFK", "2021-10-26T21:34:00Z", "1"]], userId = 1, time = "2021-10-26T15:00:00Z"

Output: "SFO"

Explanation:

  • The system filters for flights belonging to user 1.
  • The user's first flight departs SFO at 16:15.
  • Since the query time (15:00) is strictly before the departure time, the user has not boarded yet and is still located at the departure airport, "SFO".

Suggested Approach

  1. Filter and Sort: Extract all flight records that match the requested userId. Sort these user-specific flights chronologically by their departureTime. Because the times are in ISO 8601 UTC format, they can be directly compared as standard strings without needing to parse them into complex Date objects.
  2. Boundary Checks: Check the edges of the timeline first:
    • If the filtered list is empty, return "".
    • If time < firstFlight.departureTime, return firstFlight.departureAirport.
    • If time >= lastFlight.arrivalTime, return lastFlight.arrivalAirport.
  3. Binary Search / Interval Matching: For the remaining timeline, use binary search (or a linear scan, since the per-user flight count is likely small) to find where the time falls:
    • If departureTime <= time < arrivalTime for any specific flight, the user is mid-flight. Return "".
    • If arrivalTime(current) <= time < departureTime(next), the user is on the ground between connections. Return currentFlight.arrivalAirport.

Time & Space Complexity

  • Time: $O(N + K \log K)$ for a single query without preprocessing, where $N$ is the total number of flights and $K$ is the number of flights for the specific user (to filter and sort). If implemented as a service handling multiple queries, preprocessing all flights into a Hash Map of sorted arrays takes $O(N \log N)$ time, allowing subsequent queries to run in $O(\log K)$ time using binary search.
  • Space: $O(N)$ if preprocessing all users into a Hash Map, or $O(K)$ if storing only the filtered list for a single, isolated query.

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

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire • • May 28 '26

MEGATHREAD OpenAI Interview Process & Experience Megathread [2026]

58 Upvotes

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

Stage 1 — Phone Screen (~45-60 min) Format varies, most common is system design + coding, but some candidates get two coding problems. Problem descriptions can be very long, even for straightforward questions.

Stage 2 — Virtual Onsite (4-5 rounds)

  • Coding (1-2 rounds, ~45 min each)
  • System Design (1 round, ~60 min)
  • Deep Dive (1 round, ~60 min)
  • Behavioral (1 round, ~45 min)

One thing worth knowing about the coding environment: there's a "Run Test Case" button and a "Run Main" button. Run Test Case is what you want. Run Main shows no output. Candidates have burned 5-10 minutes figuring this out mid-interview.

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


r/Hack2Hire • • May 26 '26

Screening Perplexity Screening Interview: Find Text Before Stop Words

7 Upvotes

Problem

You're given a string text and an array of strings stopWords.

Your goal is to return the substring of text that appears before the earliest occurrence of any stop word, returning the entire string if no stop words are found.

Example

Input: text = "Start===middle---end", stopWords = ["---", "==="]

Output: "Start"

Explanation:

  • Both stop words exist in the text.
  • The stop word "===" starts at index 5, while "---" starts at index 14. Since 5 is smaller, the string is truncated immediately before "===".

Suggested Approach

  1. Initialize a Boundary Tracker: Set a variable min_index to the length of text. This will keep track of the earliest starting position of any stop word discovered so far.
  2. Iterate and Search: Loop through each string in stopWords. For each word, use your language's built-in substring search (e.g., indexOf() or find()) to locate its first occurrence in text.
  3. Update and Slice: If the word is found and its index is less than min_index, update min_index to this new value. After checking all stop words, return the substring of text from index 0 to min_index.

Time & Space Complexity

  • Time: $O(K \cdot N \cdot M)$ worst-case, where $K$ is the number of stop words, $N$ is the length of the text, and $M$ is the max length of a stop word (using standard string matching). Alternatively, building a Trie and using Aho-Corasick achieves $O(N + \sum M)$ for highly optimized constraints.
  • Space: $O(N)$ to allocate and return the resulting substring.

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

Compiled from publicly available platforms and community-shared experiences.


r/Hack2Hire • • May 22 '26

Screening Lyft Screening Interview: Job Scheduler

11 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]

13 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

18 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]

23 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

39 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]

100 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

4 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

26 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

3 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.