01Two Sum: return indices of the two numbers that add to a target▼easy★ EssentialMetaScalePalantir1 repliesunlockedThe most common screen opener, and interviewers use it to check whether hashmap thinking is reflexive. Here's the one-pass answer, the narration that earns points, and the duplicate-handling edge case most candidates fumble.Open full answer →
02Group anagrams: cluster a list of strings into anagram groups▼easyMetaGleanScale1 repliesunlockedA 5-minute warm-up that quietly tests the most useful idea in practical coding: choosing a canonical key. The sorted-string vs character-count tradeoff is exactly what interviewers want to hear you reason about.Open full answer →
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 →
06Count subarrays whose sum equals K▼easyMetaScaleOpenAI1 repliesunlockedLooks like a sliding-window problem; isn't one. The prefix-sum + hashmap trick that solves it is the same idea behind sessionization and cumulative-metrics questions later in the loop: learn it once, reuse it three times.Open full answer →
10Design and implement an LRU cache with O(1) get and put▼medium★ EssentialPalantirMetaxAI1 repliesunlockedThe single most-asked design-a-data-structure question in FDE loops. There's an interview-legal Python shortcut and a from-scratch version, and knowing when to offer which is half the grade.Open full answer →
71Compute the dot product of two sparse vectors.▼mediumMetaGoogle1 replies◆ premiumThe whole question is the representation: store only the nonzeros as index→value, then either two-pointer over sorted indices or hash-join. The follow-up that decides the design is what happens when one vector is dense.Open full answer →
77Longest substring without repeating characters▼medium★ EssentialAmazonMetaMicrosoft1 replies◆ premiumA sliding window with a last-seen index map, O(n) in one pass. The whole interview turns on one subtlety: when you hit a repeat, the window's left edge must jump forward and never slide backward, which is exactly the bug most candidates ship.Open full answer →
84Construct a binary tree from its preorder and inorder traversals▼mediumAmazonMicrosoftGoogle2 replies◆ premiumThe clean answer hinges on one insight: preorder names the root, inorder splits left from right. The trap is the O(n squared) version that slices arrays and scans for the root; the O(n) version uses a hashmap of inorder indices and passes bounds instead.Open full answer →