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 26–50
Place n queens on an n×n chessboard so no two queens share a row, column, or diagonal, and return all distinct board configurations. This is…
Companies: Microsoft, Netapp
Algorithm X · Array · Backtracking
Last reported Sep 2026
Determine whether the string s can be segmented into a sequence of one or more words from wordDict (words may be reused). The core challenge…
Companies: Amazon, Google, Grammarly, Meta +3
Array · Brute-Force Search · Dynamic Programming · Hash Table
Last reported Sep 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
Given repeating bus routes and start/target stops, find the minimum number of bus rides required to go from source to target (or -1 if impossible)…
Companies: Amazon, Bloomberg, Coupang, PayPal +3
Array · Breadth-First Search · Hash Table
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
Find all unique triplets in an integer array that sum to zero, ensuring no duplicate triplets in the output. The core challenge is efficiently enumerating…
Companies: Amazon, Apple, Bloomberg, Google +5
Array · Sorting · Two Pointers
Last reported Sep 2026
Given an array where nums[i] is the maximum forward jump from index i, compute the minimum number of jumps needed to reach the last index…
Companies: Amazon, Flipkart, Salesforce
Array · Dynamic Programming · Greedy
Last reported Sep 2026
For each string in an array, find the shortest substring that does not occur in any other string (choose the lexicographically smallest one among ties)…
Companies: Airbnb
Array · Hash Table · String · Trie
Last reported Sep 2026
Return the k-th largest element (by sorted order, not distinct) from an unsorted array. For inputs up to ~1e5 elements, solve it faster than full…
Companies: Bloomberg, LinkedIn, Meta, Salesforce +1
Array · Divide and Conquer · Heap (Priority Queue) · Quickselect
Last reported Sep 2026
Given an ascending array of distinct integers that has been rotated at an unknown pivot, return the index of a target value (or -1 if…
Companies: Amazon, Expedia, Google, LinkedIn +3
Array · Binary Search
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 data structure for a multiset that supports insert(val) (adding even duplicate occurrences), remove(val) (removing a single occurrence), and getRandom() (returning an…
Companies: CrowdStrike, LinkedIn, Okta
Array · Design · Hash Table · Math
Last reported Sep 2026
Given tasks labeled A–Z and a cooldown n, compute the minimum number of CPU intervals (including idles) to finish all tasks so that identical tasks…
Companies: Amazon, Apple, Databricks, Docker +3
Array · Counting · Greedy · Hash Table
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
Implement a HashMap for integer keys/values without using built-in hash table libraries that supports put, get, and remove operations. The core challenge is to design…
Companies: Anduril, Canva, Chewy, Goldman Sachs +2
Array · Design · Hash Function · 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 pairwise variable ratios, build a weighted graph (or use union-find with multiplicative weights) where edges represent divisions, and answer each query by finding a…
Companies: Amazon, Bloomberg
Array · Bellman–Ford Algorithm · Breadth-First Search · Depth-First Search
Last reported Sep 2026
Find the contiguous subarray within an integer array that yields the maximum possible sum and return that sum. This is typically solved in O(n) with…
Companies: Amazon, Google, LinkedIn, Meta +5
Array · Divide and Conquer · Dynamic Programming
Last reported Sep 2026
Given an initially all-water m×n grid, process a sequence of add-land operations and return the number of islands (4-directionally connected land components) after each…
Companies: LinkedIn, Microsoft, Uber
Array · Hash Table · Union-Find
Last reported Sep 2026
For each index in an integer array, compute the product of all other elements without using division and in O(n) time — typically done by…
Companies: Amazon, Asana, Meta, Snap
Array · Prefix Sum
Last reported Sep 2026
Design a versioned array that supports point updates, taking snapshots (returning increasing snap_ids), and querying the value at an index for a given snap_id. The…
Companies: Amazon, Anduril, Apple, MongoDB
Array · Binary Search · Design · Hash Table
Last reported Sep 2026
Given a sorted list of words in an unknown alphabet, infer the relative ordering of characters by deriving precedence constraints between first differing letters, then…
Companies: Amazon, Bloomberg, Google, Intuit +3
Array · Breadth-First Search · Depth-First Search · Directed Acyclic Graph
Last reported Aug 2026
Given an array of building heights and limited bricks and ladders, find the furthest building index you can reach from 0 by covering each positive…
Companies: D. E. Shaw, SchröDinger
Array · Greedy · Heap (Priority Queue)
Last reported Aug 2026
Simulate batched buy/sell order matching where each buy matches with the lowest-price sell (and each sell with the highest-price buy), allowing partial fills until no…
Companies: Amazon, Citadel
Array · Heap (Priority Queue) · Simulation
Last reported Aug 2026
Given a string s and a word dictionary, return all possible sentences formed by inserting spaces so every token is a dictionary word — i.e.…
Companies: Bloomberg, Meta, ServiceNow
Array · Backtracking · Dynamic Programming · Hash Table
Last reported Aug 2026