Top K Frequent Elements with Descending Value Tie-Break

Given an integer array nums and an integer k, return the k distinct elements with the highest frequencies.

Ordering rules:

  1. Higher frequency comes first.
  2. If two elements have the same freq...

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: