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 276–300
Companies: Google
Array · Binary Search
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
Companies: Google
Array · Binary Search · Math · Number Theory
Companies: General Motors
Array · Dynamic Programming · Memoization
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 an integer array where you may replace any element with two positive integers summing to it, find the minimum number of such split operations…
Companies: Salesforce
Array · Greedy · Math
Companies: Amazon
Array · Hash Table · Sliding Window
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)
Companies: Amazon
Array · Counting · Greedy · Hash Table
Companies: Infosys
Array · Math · Simulation
Companies: Google
Array · Bit Manipulation · Dynamic Programming · Matrix
Given a sequence of ID updates where each step adds or removes a given number of copies of an ID, maintain the dynamic multiset of…
Companies: Snowflake
Array · Hash Table · Heap (Priority Queue) · Ordered Set
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
Count the number of ways to form target left-to-right by picking each target character from some word’s character at column k, with the constraint that…
Companies: Uber
Array · Dynamic Programming · String
Count the number of ways to assign distinct hats (labels 1..40) to n ≤ 10 people given each person's allowed hat list, returning the answer…
Companies: Roblox
Array · Bipartite Graph · Bit Manipulation · Bitmask
Partition the array into contiguous subarrays of length at most k, replace every value in a subarray with that subarray's maximum, and maximize the resulting…
Companies: TikTok
Array · Dynamic Programming
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
Generate the first numRows of Pascal's Triangle as a list of lists, where each row starts and ends with 1 and every interior element equals…
Companies: Bloomberg
Array · Dynamic Programming
Companies: Google
Array · Hash Table · Heap (Priority Queue) · Math
Partition the array into k contiguous nonempty subarrays where each bag's cost is the sum of its endpoint weights, so the total score equals weights[0]+weights[n-1]…
Companies: Salesforce
Array · Greedy · Heap (Priority Queue) · Sorting
Given a set of 2D integer points and multiple circular queries, compute for each circle how many points lie inside or on it; the main…
Companies: Anduril
Array · Geometry · Math
Sort teams by aggregating position-wise vote counts: compare teams by their counts for first place, then second place, and so on, using alphabetical order as…
Companies: Atlassian
Array · Counting · Hash Table · Sorting
Implement a read(n) method using the provided read4(buf) API where read may be called multiple times; you must preserve and reuse leftover characters between calls…
Companies: Lyft, NVIDIA
Array · Interactive · Simulation
Given an array of pile sizes and k operations each removing floor(pile/2) stones from a chosen pile (possibly the same pile multiple times), minimize the…
Companies: Salesforce
Array · Greedy · Heap (Priority Queue)