Interview questions
Find a company or topic. Read the sources, then practice.
Loading the question library…
Find a company or topic. Read the sources, then practice.
Loading the question library…
Showing 51–75
Given an array of n integers, return the element that appears more than ⌊n/2⌋ times (the majority element is guaranteed to exist). The goal is…
Companies: Amazon, Bloomberg, Coupang, Google +1
Array · Boyer–Moore Majority Vote Algorithm · Counting · Divide and Conquer
Last reported Aug 2026
Given a grid with buildings (1), empty land (0), and obstacles (2), find an empty cell that minimizes the sum of shortest (Manhattan) path distances…
Companies: Amazon, Coupang, DoorDash, Goldman Sachs +2
Array · Breadth-First Search · Matrix
Last reported Aug 2026
Given an array of integers and a target, return the indices of two distinct elements whose values sum to the target (exactly one valid solution…
Companies: Amazon, Apple, Bloomberg, Brex +13
Array · Hash Table
Last reported Aug 2026
Given N points on the plane and an integer k, return the k points with the smallest Euclidean distance to the origin (order doesn't matter)…
Companies: Airbnb, Amazon, Asana, Meta
Array · Divide and Conquer · Geometry · Heap (Priority Queue)
Last reported Aug 2026
Given timestamped friendship events among N people, determine the earliest time when the social graph becomes fully connected; process events in chronological order and use…
Companies: Amazon, Google, Uber
Array · Sorting · Union-Find
Last reported Aug 2026
Given an m×n grid with empty cells, fresh (1) and rotten (2) oranges, compute the minimum minutes until all fresh oranges become rotten as rot…
Companies: Amazon, Anduril, Flipkart, Goldman Sachs +3
Array · Breadth-First Search · Matrix
Last reported Aug 2026
Given lists of accounts where each account has a name and emails, merge accounts that share any email by grouping connected emails (e.g., via union-find…
Companies: Airbnb, Bloomberg, Meta, Oracle +1
Array · Breadth-First Search · Depth-First Search · Hash Table
Last reported Aug 2026
Find the minimum ship capacity such that the weights array can be partitioned (in order) into at most D contiguous daily loads whose sums do…
Companies: Amazon, Meta, Snap
Array · Binary Search
Last reported Aug 2026
For each price, compute the final cost as price minus the first subsequent price to its right that is <= it (or the same price…
Companies: Uber, Walmart
Array · Monotonic Stack · Stack
Last reported Aug 2026
Find the length of the longest run of consecutive integers in an unsorted array, with an O(n) time requirement. The core idea is to detect…
Companies: Amazon, Bloomberg, Google, Microsoft +1
Array · Hash Table · Union-Find
Last reported Aug 2026
Given an integer array sorted in non-decreasing order (which may contain negative numbers), return a new array of the squares of each number, also sorted…
Companies: Bloomberg, Instacart, Uber
Array · Sorting · Two Pointers
Last reported Aug 2026
Determine whether a target word can be formed by a path of horizontally or vertically adjacent cells in an m×n letter grid without reusing a…
Companies: Amazon, Glean, Google, Grammarly +3
Array · Backtracking · Depth-First Search · Matrix
Last reported Jul 2026
Given a sorted (ascending) array of unique integers and a target value, return the index of the target or -1 if not present; the solution…
Companies: Amazon, Bloomberg, Google, Meta +1
Array · Binary Search
Last reported Jul 2026
Given a set of weighted intervals, pick at most two non-overlapping events (events are inclusive, so the next must start at least end+1) to maximize…
Companies: Goldman Sachs, Grammarly
Array · Binary Search · Dynamic Programming · Heap (Priority Queue)
Last reported Jul 2026
Find the minimum number of steps from the top-left to bottom-right in a 4-directional binary grid if you may remove up to k obstacles; treat…
Companies: Amazon, Cisco, D. E. Shaw, Databricks +2
Array · Breadth-First Search · Matrix
Last reported Jul 2026
Aggregate points for each distinct number (value * frequency), then choose a subset of values maximizing sum with the constraint that taking value x forbids…
Companies: Walmart, Walmart Labs
Array · Dynamic Programming · Hash Table
Last reported Jul 2026
Design an allocator for n memory units that supports allocating the leftmost contiguous block of a given size and freeing all units with a given…
Companies: Apple, OpenAI, Roblox
Array · Design · Hash Table · Simulation
Last reported Jul 2026
Given a sorted (non-decreasing) array, return the starting and ending indices of a target value (or [-1, -1] if it’s not present). The challenge is…
Companies: Amazon, Apple, Meta, NVIDIA +3
Array · Binary Search
Last reported Jul 2026
Given timestamped website visits by users, find the 3-website sequence (in chronological order) that is visited by the largest number of unique users (count each…
Companies: Amazon, Spotify
Array · Hash Table · Sorting · String
Last reported Jul 2026
Given two non-decreasing arrays, return the k pairs (one element from each) with the smallest sums — the challenge is to efficiently produce the smallest…
Companies: LinkedIn
Array · Heap (Priority Queue)
Last reported Jul 2026
Given an m×n grid of alphanumeric characters and a target pattern string, determine whether the pattern can be formed by a path of adjacent (up/down/left/right)…
Companies: Meta, Roblox
Array · Hash Table · Matrix · String
Last reported Jul 2026
Assign each meeting (with unique start times) to the lowest-numbered available room or delay it (keeping its duration and prioritizing earlier original start times) until…
Companies: Apple, Docusign, Google, Meta +2
Array · Hash Table · Heap (Priority Queue) · Simulation
Last reported Jul 2026
Given a list of intervals (endpoints touching allowed), find the minimum number to remove so the remaining intervals are pairwise non-overlapping — equivalently, select the…
Companies: Amazon, Docusign, Grammarly
Array · Dynamic Programming · Greedy · Sorting
Last reported Jul 2026
Return the longest prefix string common to all strings in the array, or an empty string if none exists. The task reduces to comparing characters…
Companies: Amazon, Apple, Bloomberg, Google +3
Array · String · Trie
Last reported Jun 2026
Choose a subset of non-overlapping jobs (jobs may touch at endpoints) to maximize total profit — the classical weighted interval scheduling problem. With up to…
Companies: Airbnb
Array · Binary Search · Dynamic Programming · Sorting
Last reported Jun 2026