Top 50 top k Interview Questions
The most frequently asked top k questions across all roles and companies, ranked by real interview frequency. Updated daily.
Find the k most frequent elements in an array using counting and a heap or bucket strategy.
Allegis Group
Delta Electronics Americas
AccentureUse in-place Quickselect to find the kth largest array element without sorting the full input.
Tencent
New RelicReturn the top-k frequent event codes using a frequency map and bounded min-heap.
QualysReturn the k largest array elements using a min-heap with O(n log k) time and O(k) space.
Maintain changing item frequencies and return the top K items using a hash map and lazy min-heap.
Goldman Sachs Asset & Wealth ManagementUse a heap-based priority queue to keep the k closest obstacle readings from a sensor stream.
WaymoUse a size-k heap to return the indices of the k smallest distances with deterministic tie-breaking.
InfosysRank Facebook users by total session duration and return the top 10% using aggregation and NTILE.
Facebook
Activision
AppsFlyerCompare normalized character signatures to determine whether each pair of strings is an anagram.
AdobeCalculate the sum of integers from 1 to 1,000,000 using PostgreSQL aggregation and filtering.
Virtu FinancialSign up to see every question
Create a free account to unlock this list and practice real interview questions.