Your question is Top K Frequent Elements. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given an integer array nums and an integer k, return the k elements that appear most frequently. You may return the answer in any order.
nums, a list of integersk, an integerk most frequent elements in numsIf multiple valid answers exist, return any one of them.
def top_k_frequent(nums, k):