05Top-K frequent elements▼easy★ EssentialMetaGleanOpenAI2 repliesunlockedTop-K is the most reused primitive in FDE interviews: it reappears inside log parsers, analytics questions, and retrieval ranking. Three solutions exist; knowing which one to lead with is the real test.Open full answer →
11Merge K sorted lists into one sorted output▼mediumMetaGleanScale1 replies○ sign inK-way merge is the algorithm behind log aggregation, search-result merging, and LSM trees, which is exactly why FDE loops keep asking it. The heap version is table stakes; the tie-breaking detail is where candidates crash.Open full answer →
35Build a system to manage GPU credits across companies with wildly different usage patterns▼hardOpenAI1 replies◆ premiumA reported OpenAI build that looks like billing and is actually a data-structure question in disguise: credit grants that expire, usage that must burn the right grant first, and balance queries at arbitrary times. The earliest-expiry-first invariant carries the whole problem.Open full answer →
85Find the k closest points to the origin▼mediumMetaAmazon2 replies◆ premiumThe tell is whether you avoid the trap of sorting all n points when you only need k. Two real answers: a max-heap of size k at O(n log k), or quickselect at O(n) average. Knowing which one the interviewer wants is the actual question.Open full answer →
86Sort a k-sorted array, where each element is at most k positions from its final place▼mediumAmazonGoogle2 replies◆ premiumA full sort throws away the structure you were handed. Because no element moves more than k slots, a min-heap of size k+1 always has the next smallest element on top, sorting in O(n log k) and one pass.Open full answer →