Algorithm · Uber · Medium
You are given an integer array nums and an integer k. Find the k values that occur most often in nums and return them. The test data is built so that the set of k most frequent values is always unique, so there are no ties to break. The values may be returned in any order. Example 1: Example 2: Constraints: 1 <= nums.length <= 10^4 -1000 <= nums[i] <= 1000 1 <= k <= the number of distinct values in nums