Amazon Interview Question

Leetcode style question: Top K frequent elements