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 51–61
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
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
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
Given an array of positive integers (bag counts), remove beans (only deletions allowed) so that every non-empty bag has the same count, minimizing total beans…
Companies: D. E. Shaw
Array · Enumeration · Greedy · Prefix Sum
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)
Determine whether two strings are anagrams — i.e., contain the same multiset of characters — by comparing their character frequency distributions (or sorted forms). Inputs…
Companies: Amazon, Google, Meta, Microsoft +1
Hash Table · Sorting · String
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