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 101–125
Find the length of the longest contiguous subarray whose maximum minus minimum is ≤ limit; the key challenge is maintaining the window's current min and…
Companies: MongoDB, Uber
Array · Heap (Priority Queue) · Monotonic Queue · Ordered Set
Last reported Apr 2026
Count the number of contiguous subarrays whose minimum equals minK and maximum equals maxK. The main challenge is to efficiently (O(n)) scan the array, partitioning…
Companies: Adobe, Uber
Array · Monotonic Queue · Queue · Sliding Window
Last reported Apr 2026
Implement a BrowserHistory class that supports visiting URLs (which clears any forward history), moving back or forward up to a specified number of steps, and…
Companies: Amazon, Bloomberg, Chime
Array · Data Stream · Design · Doubly-Linked List
Last reported Apr 2026
Rearrange the array in-place to produce the lexicographically next greater permutation (using only O(1) extra space); if no larger permutation exists, reorder it to the…
Companies: Amazon, Bloomberg, Meta, Microsoft
Array · Two Pointers
Last reported Apr 2026
Rearrange the array in-place so all zeros are moved to the end while preserving the relative order of non-zero elements, without using extra storage. Aim…
Companies: Amazon, Google, Meta, Microsoft
Array · Two Pointers
Last reported Apr 2026
Given an array of building heights, return the indices of buildings that have an unobstructed view to the ocean on the right (i.e., no building…
Companies: Anduril, Meta
Array · Monotonic Stack · Stack
Last reported Apr 2026
Given signed integers for asteroid sizes and directions, determine which asteroids remain after sequential collisions where only opposite-moving neighbors (positive then…
Companies: Amazon, D. E. Shaw, JPMorgan Chase, Meta +2
Array · Simulation · Stack
Last reported Mar 2026
Design a data structure that, given a continuous stream of numbers and a fixed window size k, returns the moving average of the last k…
Companies: Box, Google, Meta, Spotify
Array · Data Stream · Design · Queue
Last reported Mar 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
Count the number of contiguous, non-empty subarrays whose elements sum to k. Because nums can include negatives (so two-pointer sliding window doesn't work), use cumulative…
Companies: Amazon, Apple, Bloomberg, Google +3
Array · Hash Table · Prefix Sum
Last reported Mar 2026
Given daily stock prices, compute the maximum profit you can achieve with unlimited buy/sell operations while holding at most one share at a time (you…
Companies: Apple, Bloomberg, Meta, Oracle
Array · Dynamic Programming · Greedy
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 recipes whose ingredients may include other recipes and an initial set of supplies, determine which recipes can be produced; the core challenge is dependency…
Companies: Amazon, Google, Tesla
Array · Directed Acyclic Graph · Graph Theory · Hash Table
Last reported Feb 2026
Split the array into k non-empty contiguous subarrays so that the maximum subarray sum is as small as possible, and return that minimized largest sum…
Companies: Amazon, Google, Microsoft, Pinterest +2
Array · Binary Search · Dynamic Programming · Greedy
Last reported Feb 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
Design a class that stores an integer array and supports reset (returning the original configuration) and shuffle (returning a uniformly random permutation so that all…
Companies: Microsoft, Uber
Array · Design · Math · Randomized
Last reported Feb 2026
Simulate a robot on an infinite grid executing turn commands and unit-step moves, stopping any step that would hit an obstacle and updating its facing…
Companies: Apple, Meta, Shopify
Array · Hash Table · Simulation
Last reported Feb 2026
Find the contiguous subarray with the largest product in an integer array; because negatives and zeros can flip signs, you must track both the running…
Companies: LinkedIn, Microsoft
Array · Dynamic Programming
Last reported Feb 2026
Given an array of nonnegative integers representing house values, find the maximum sum you can obtain by selecting houses with the constraint that no two…
Companies: Amazon, Apple, Goldman Sachs, Microsoft
Array · Dynamic Programming
Last reported Jan 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
Given a list of words and two distinct target words, find the minimum absolute index distance between any occurrence of the two targets. This is…
Companies: LinkedIn, Snowflake
Array · String
Last reported Dec 2025
For each node c in a weighted tree, count unordered pairs of distinct servers (a,b) (neither equal to c) such that the distances from c…
Companies: NVIDIA, Rippling
Array · Depth-First Search · Tree
Last reported Dec 2025
Given a binary array, return the length of the longest contiguous run of 1s — essentially find the maximum number of consecutive 1s in a…
Companies: Google, Microsoft
Array
Last reported Dec 2025
Find the length of the longest contiguous "mountain" subarray — a strictly increasing sequence immediately followed by a strictly decreasing sequence with length ≥ 3…
Companies: Oracle, TikTok
Array · Dynamic Programming · Enumeration · Two Pointers
Last reported Nov 2025