Problem 347 · Medium

Top K Frequent Elements

Count frequencies then bucket by frequency; scan buckets from high to low to collect top-k.

Open the interactive visualisation