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 1–25
Given an m x n matrix where each row and each column is sorted in ascending order, determine whether a target value exists by exploiting…
Companies: Amazon, Goldman Sachs
Array · Binary Search · Divide and Conquer · Matrix
Last reported Oct 2026
Count the number of islands (4-directionally connected components of '1's) in an m×n binary grid. This is a connected-components/flood-fill problem typically solved with…
Companies: Amazon, Anduril, Apple, ByteDance +16
Array · Breadth-First Search · Depth-First Search · Matrix
Last reported Sep 2026
For each query threshold, compute how many distinct cells you can reach from the top-left by moving 4-directionally through cells whose value is strictly less…
Companies: Uber
Array · Breadth-First Search · Heap (Priority Queue) · Matrix
Last reported Sep 2026
Traverse the m×n matrix in clockwise spiral order (right, down, left, up) and return the elements in that sequence. The core challenge is managing changing…
Companies: Capital One, Liveramp, Meta, Microsoft +1
Array · Matrix · Simulation
Last reported Sep 2026
Design a spreadsheet supporting set/get and sum operations where sum formulas can reference individual cells and rectangular ranges; the core challenge is maintaining a…
Companies: Airbnb, Discord
Array · Design · Graph Theory · Hash Table
Last reported Sep 2026
Design a Spreadsheet class with 26 columns and a specified number of rows that supports setCell and resetCell operations and stores integer values (unset cells…
Companies: Citadel, Discord
Array · Design · Hash Table · Matrix
Last reported Sep 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 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
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
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
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
Given a binary matrix where each row is sorted non-decreasing (all 0s before 1s) and you can only query entries via a provided API, find…
Companies: Uber
Array · Binary Search · Interactive · Matrix
Last reported Jun 2026
Given a binary grid, count how many distinct island shapes (connected components of 1s via 4-directional adjacency) appear, treating two islands as identical if they…
Companies: Anduril, Oracle, TikTok
Array · Breadth-First Search · Depth-First Search · Hash Function
Last reported Jun 2026
Given an m×n matrix where each row is sorted and the first element of each row is greater than the last of the previous row…
Companies: Amazon, Goldman Sachs, Meta, Microsoft +1
Array · Binary Search · Matrix
Last reported Jun 2026
Simulate a Minesweeper click on an m×n board: clicking a mine turns it to 'X', while clicking an empty square requires counting adjacent mines —…
Companies: Meta, Microsoft, Nuro, Uber
Array · Breadth-First Search · Depth-First Search · Matrix
Last reported Jun 2026
Given an m×n letter grid and a list of words, find all words that can be formed by sequentially adjacent (horizontal/vertical) non-repeating cells. The core…
Companies: Amazon, Bloomberg, Glean, Google +2
Array · Backtracking · Matrix · String
Last reported Jun 2026
Given an n×n binary grid (n a power of two), recursively build a quadtree by subdividing the grid into four equal quadrants until each region…
Companies: Snowflake, Uber
Array · Divide and Conquer · Matrix · Tree
Last reported May 2026
Check a 9x9 Sudoku board is valid by verifying that no digit 1–9 (ignoring '.') appears more than once in any row, column, or 3x3…
Companies: Amazon, Cisco, Microsoft
Array · Hash Table · Matrix
Last reported May 2026
Given a grid with grass, fire, and impassable walls, determine the maximum minutes you can wait at (0,0) before starting to move so that you…
Companies: Google, Uber
Array · Binary Search · Breadth-First Search · Matrix
Last reported May 2026
Given an n×n binary grid where you can flip at most one 0 to 1, compute the largest possible 4-directional island size after the flip…
Companies: DoorDash, Meta, TikTok, Uber
Array · Breadth-First Search · Depth-First Search · Matrix
Last reported Mar 2026
Given an m×n grid of non-negative numbers, find the minimum-sum path from the top-left to bottom-right when you may only move right or down. This…
Companies: Goldman Sachs, Oracle
Array · Dynamic Programming · Matrix
Last reported Mar 2026
Given an m×n board of integer "candies," repeatedly find and remove any horizontal or vertical runs of ≥3 identical candies, let the remaining candies fall…
Companies: Meta, Microsoft, Roblox
Array · Matrix · Simulation · Two Pointers
Last reported Feb 2026
Given an m×n binary matrix, find the area of the largest axis-aligned square submatrix that contains only '1's. This is a classic DP problem (m,n…
Companies: eBay, Expedia
Array · Dynamic Programming · Matrix
Last reported Jan 2026
Given an n×n binary grid where 0s are open and 1s are blocked, return the length (number of cells) of the shortest 8-directionally connected path…
Companies: Amazon, Anduril, Meta
Array · Breadth-First Search · Matrix
Last reported Dec 2025
Compute each cell's Manhattan distance to the nearest thief, then find a path from (0,0) to (n-1,n-1) that maximizes the minimum of those distances along…
Companies: Google, Meta, Uber
Array · Binary Search · Breadth-First Search · Heap (Priority Queue)
Last reported May 2025