Day 5 - Top K Frequent Elements
Question
Given an integer array nums and an integer k, return the k most frequent elements within the array.
Example 1
Input: nums = [1,2,2,3,3,3], k = 2
Output: [2,3]
Example 2
Input: nums = [7, 7], k = 1
Output: [7]
Approach
In this question, we ha...
blogs-himanshu.hashnode.dev2 min read