Top K Frequent Elements

Top K Frequent Elements

Given an integer array nums of length n and an integer k, return the k distinct elements that occur most frequently in the array.

The output order does not matter. ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: