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 1–10
Count word frequencies and return the k most frequent words sorted by descending frequency, breaking ties by lexicographical order. The core challenge is combining frequency…
Companies: Apple, Microsoft, Oracle, Robinhood
Array · Bucket Sort · Counting · Hash Table
Last reported Oct 2026
Given an integer array and k, return the k most frequent elements — the core challenge is to count element frequencies and extract the top-k…
Companies: Amazon, Bloomberg, Google, Meta +9
Array · Bucket Sort · Counting · Divide and Conquer
Last reported Oct 2026
Return the index of the first character in s that occurs exactly once (or -1 if none). This is typically solved by counting character frequencies…
Companies: Apple, Goldman Sachs
Counting · Hash Table · Queue · String
Last reported Sep 2026
Given tasks labeled A–Z and a cooldown n, compute the minimum number of CPU intervals (including idles) to finish all tasks so that identical tasks…
Companies: Amazon, Apple, Databricks, Docker +3
Array · Counting · Greedy · Hash Table
Last reported Sep 2026
Determine whether ransomNote can be formed from magazine by verifying that for every character, magazine contains at least as many occurrences as needed — i.e.…
Companies: Anduril, Pinterest
Counting · Hash Table · String
Last reported Sep 2026
Given an array of n integers, return the element that appears more than ⌊n/2⌋ times (the majority element is guaranteed to exist). The goal is…
Companies: Amazon, Bloomberg, Coupang, Google +1
Array · Boyer–Moore Majority Vote Algorithm · Counting · Divide and Conquer
Last reported Aug 2026
Rearrange the characters of a string so that no two adjacent characters are the same, returning any valid permutation or "" if none exists. Key…
Companies: Amazon, D. E. Shaw, Tesla
Counting · Greedy · Hash Table · Heap (Priority Queue)
Last reported Jan 2025
Find all integers that occur exactly once in nums and whose immediate neighbors (x-1 and x+1) do not appear in the array; return these "lonely"…
Companies: Apple
Array · Counting · Hash Table
Partition the string into the fewest contiguous substrings such that each substring is "balanced" (every distinct character in the substring appears the same number of…
Companies: Grammarly
Counting · Dynamic Programming · Hash Table · String
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