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–38
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
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 a list of (studentId, score) pairs, compute each student's average of their top five scores and return the results as (studentId, average) sorted by…
Companies: Goldman Sachs
Array · Hash Table · Heap (Priority Queue) · Sorting
Given an array of stone weights, repeatedly take the two heaviest stones, remove them, and if their weights differ push back the difference; return the…
Companies: Apple, Salesforce
Array · Heap (Priority Queue)
Choose k workers and pay each proportional to quality while meeting their minimum wages; the group's cost equals (sum of selected qualities) * max(wage[i]/quality[i]) among…
Companies: Apple
Array · Greedy · Heap (Priority Queue) · Sorting
Given a target distance, initial fuel, and stations at positions with fuel amounts, determine the minimum number of refueling stops needed to reach the target…
Companies: D. E. Shaw, Uber, Waymo
Array · Dynamic Programming · Greedy · Heap (Priority Queue)
Given an array of positive integers where an operation halves any chosen element, find the minimum number of operations to reduce the total sum by…
Companies: Nutanix
Array · Greedy · Heap (Priority Queue)
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 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
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 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)
Given lists of positive and negative words and one feedback report per student, compute each student's score (+3 per positive word, -1 per negative word)…
Companies: Booking.com
Array · Hash Table · Heap (Priority Queue) · Sorting
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)