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
AccentureReturn the k largest array elements in descending order using a size-k min-heap.
Use in-place Quickselect to find the kth largest array element without sorting the full input.
Tencent
New RelicUse a size-k heap to return the indices of the k smallest distances with deterministic tie-breaking.
InfosysTrack the k most frequent items from a stream using a hash map and heap.
Track message frequencies and return the top K errors using a bounded min-heap with deterministic lexicographic tie-breaking.
SAPAggregate sales by category and return the three highest-performing categories.
Rank Facebook users by total session duration and return the top 10% using aggregation and NTILE.
Facebook
Activision
AppsFlyerReturn the first row for each unique value, then rank the k most frequent values.
EverlawSign up to see every question
Create a free account to unlock this list and practice real interview questions.