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 126–150
Count how many ways to assign +/− to each element of nums so the signed sum equals target. This reduces to a subset-sum problem: count…
Companies: Meta, Pinterest
0-1 Knapsack · Array · Backtracking · Dynamic Programming
Last reported Nov 2025
Given tasks with enqueue and processing times, return the order a single-threaded CPU will process them when it always picks the available task with the…
Companies: DoorDash, TikTok
Array · Heap (Priority Queue) · Sorting
Last reported Oct 2025
Choose heights within [1, maxHeights[i]] that form a mountain (nondecreasing to a single peak then nonincreasing) to maximize the total sum. Core challenge: for each…
Companies: Bloomberg, Expedia
Array · Monotonic Stack · Stack
Last reported Sep 2025
Given an array of distinct integers, repeatedly compare the first two elements, keeping the larger at the front and moving the smaller to the back…
Companies: Amazon, Goldman Sachs
Array · Simulation
Last reported Sep 2025
Given two sorted, pairwise-disjoint lists of closed intervals, return all non-empty intersections between intervals from the two lists. Because each list is ordered and…
Companies: Meta, Verkada
Array · Sweep Line · Two Pointers
Last reported Sep 2025
Find the length of the shortest contiguous subarray of positive integers whose sum is at least a given target (return 0 if none exists). This…
Companies: Bloomberg, Meta, Toast
Array · Binary Search · Prefix Sum · Sliding Window
Last reported Aug 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
Find the median of two sorted arrays in O(log(m+n)) time by using binary search to partition the arrays so the left half contains the correct…
Companies: Amazon, Bloomberg, eBay, Goldman Sachs +5
Array · Binary Search · Divide and Conquer
Last reported Apr 2025
Given an n×n matrix, rotate it 90° clockwise in-place (no extra matrix allowed), i.e., rearrange the elements so each row becomes the corresponding column after…
Companies: Bloomberg, ByteDance, Meta, NVIDIA
Array · Math · Matrix
Last reported Feb 2025
Given a sorted array of distinct integers and a target, return the index where the target is found or the index where it should be…
Companies: Bloomberg, Google, Grammarly, Meta
Array · Binary Search
Last reported Jan 2025
Simulate days on an m×n grid where infected cells spread 4-directionally: each day identify all connected infected regions, compute for each the set of uninfected…
Companies: Flipkart, Uber
Array · Breadth-First Search · Depth-First Search · Matrix
Last reported Jan 2025
Partition the array so that all even numbers appear before all odd numbers, returning any arrangement that satisfies this; order within the even/odd groups doesn't…
Companies: Meta, Zoho
Array · Sorting · Two Pointers
Last reported Jan 2025
Given up to 300 unique 2D points, return the maximum number that lie on the same straight line. The core challenge is grouping points by…
Companies: Google, LinkedIn
Array · Euclidean Algorithm · Geometry · Greatest Common Divisor
Last reported Jan 2025
Find the length of the shortest contiguous subarray whose sum is at least k, or return -1 if none exists. Because nums can contain negative…
Companies: Meta
Array · Binary Search · Heap (Priority Queue) · Monotonic Queue
Last reported Jan 2025
Determine whether the array can be partitioned into two subsets with equal sum — equivalently, check if there exists a subset that sums to half…
Companies: Google, Microsoft
0-1 Knapsack · Array · Dynamic Programming · Knapsack Problem
Last reported Dec 2024
Given an array where every element appears exactly twice except for one, return the element that appears only once. Achieve O(n) time and O(1) space…
Companies: Amazon, Bloomberg, Meta
Array · Bit Manipulation
Last reported Dec 2024
Find all pairs of distinct integers that achieve the minimum absolute difference; the typical approach is to sort the array and collect adjacent pairs with…
Companies: Amazon, Walmart Labs
Array · Sorting
Last reported Nov 2024
Find the maximum sum of unique node values collectible by any walk that starts and ends at node 0 within a given time budget on…
Companies: Amazon, Nutanix
Array · Backtracking · Graph Theory
Last reported Nov 2024
Evaluate the integer value of an expression given in Reverse Polish Notation, where tokens are integers or the operators +, -, *, / and all…
Companies: Citadel, Google
Array · Math · Stack
Last reported Nov 2024
Reorder an array of values 0, 1, and 2 in-place so all 0s come first, then 1s, then 2s (the Dutch National Flag problem); aim…
Companies: Amazon, Google, Microsoft, Walmart Labs
Array · Bubble Sort · Quicksort · Sorting
Last reported Oct 2024
Return true if any integer appears at least twice in the array and false if all elements are distinct. Array length can be up to…
Companies: Google, Meta
Array · Hash Table · Sorting
Last reported Oct 2024
Given a string and allowed index swap pairs, view pairs as edges in a graph to find connected components where characters can be freely permuted…
Companies: Goldman Sachs, Google
Array · Breadth-First Search · Depth-First Search · Hash Table
Last reported Oct 2024
Maintain dynamic collections to (1) return the cheapest up-to-5 shops that have an unrented copy of a given movie and (2) report the cheapest up-to-5…
Companies: Amazon, Okta
Array · Design · Hash Table · Heap (Priority Queue)
Last reported Sep 2024
Determine whether the array contains indices i < j < k such that nums[i] < nums[k] < nums[j] (a "132" subsequence). With n up to…
Companies: DoorDash
Array · Binary Search · Monotonic Stack · Ordered Set
Given an integer array and a target, find three numbers whose sum is closest to the target (unique solution guaranteed) and return that sum. This…
Companies: Bloomberg
Array · Sorting · Two Pointers