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
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
Companies: OpenAI
Binary Search
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
Companies: OpenAI
Binary Search
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 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
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 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
Assign dry operations on zero days so that no lake is rained on while already full: given a sequence where rains[i]>0 fills a lake and…
Companies: MongoDB
Array · Binary Search · Greedy · Hash Table
Given an unsorted array, count the elements that are "binary searchable" — values that would be found by standard binary search without sorting, meaning every…
Companies: Uber
Array · Binary Search · Monotonic Stack · Stack
Support inserting obstacles at points on the nonnegative number line and, for each query, determine whether there exists any obstacle-free interval of length >= sz…
Companies: Hudson River Trading, Roblox, TikTok
Array · Binary Indexed Tree · Binary Search · Ordered Set
Place n unit cubes into stacks on an n×n floor with the rule that a cube can be stacked only if the supporting cube's four…
Companies: Adobe
Binary Search · Greedy · Math
Given positions of houses and heaters on a line, find the minimum uniform radius R such that every house is within distance R of some…
Companies: Anduril
Array · Binary Search · Sorting · Two Pointers
Given an array of integers, return the length of the longest strictly increasing subsequence; the core challenge is to compute this efficiently—naive DP is O(n^2)…
Companies: PayPal
Array · Binary Search · Dynamic Programming · Longest Increasing Subsequence
Companies: Atlassian
Binary Search · Greedy
Remove elements from either end to make the sum of removed elements equal x; equivalently, find the longest contiguous subarray whose sum equals total(nums) -…
Companies: Bloomberg
Array · Binary Search · Hash Table · Prefix Sum
Given nums and k, remove the fewest elements so the remaining array has max ≤ k * min. Equivalently, find the largest subset of numbers…
Companies: Salesforce
Array · Binary Search · Sliding Window · Sorting
Given two arrays and up to k1 and k2 unit +/-1 edits, minimize the sum of (nums1[i]-nums2[i])^2 by optimally allocating k = k1+k2 operations to…
Companies: Google
Array · Binary Search · Greedy · Heap (Priority Queue)
Given a list of closed time intervals for when each flower is in full bloom and query times for people arriving, return for each person…
Companies: Roblox
Array · Binary Search · Hash Table · Ordered Set
Partition the 2n integers into two equal-sized groups (choose n elements for one group) to minimize the absolute difference of their sums — a constrained…
Companies: Salesforce
Array · Binary Search · Bit Manipulation · Bitmask
Count the number of index pairs (i, j) with 0 ≤ i < j < n such that nums[i] > 2 * nums[j]; this is…
Companies: eBay
Array · Binary Indexed Tree · Binary Search · Divide and Conquer
Given inventories where each sale of a color yields value equal to its current count and reduces that count by one, choose which balls to…
Companies: Goldman Sachs
Array · Binary Search · Greedy · Heap (Priority Queue)
Compute the integer square root: for a non-negative integer x (0 ≤ x ≤ 2^31-1), return floor(sqrt(x)) without using built-in exponent functions — typically solved…
Companies: Google
Binary Search · Math · Newton's Method
Count the number of triplets (i, j, k) from nums that can form triangle side lengths — i.e., three values a ≤ b ≤ c…
Companies: Bloomberg
Array · Binary Search · Greedy · Sorting