Medium

Quiz

#347 Top K Frequent Elements

APPROACH

Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.

1 of 4

What is the optimal approach for this problem?