Python data engineering interview problem. Difficulty: intermediate. Pattern: Sorting. About 15 minutes. Part of the Pro drill bank.
An activity feed lists account ids. Support wants the k accounts that appear most often so they can investigate noisy customers first.
Return the top-k most frequent accounts.
Input: top_k_accounts(['a', 'b', 'a', 'c', 'b', 'a'], 2) Output: ['a', 'b'] This input follows the stated rules and produces this output.
Topics: lakebench, python, sorting.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Given a list of account activity events, return the K accounts with the most events.
Return the top-k most frequent accounts.