Top k most active symbols
Asked at Citadel, Point72
Given the full tape of traded symbols, return the k symbols that printed most often. Break ties alphabetically. You want to avoid a full sort of all distinct symbols when k is small.
tape = ["A", "A", "B", "C", "B", "A"], k = 2
-> ["A", "B"] # A prints 3 times, B twice
Return the k highest-frequency symbols, ties broken alphabetically. Aim for or better.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.