Thanksgiving Sale: Use Coupon Code THANKS25 to Get Extra 25% Off.
freq of size 1001 with all elements set to 0.arr in nums.
num in arr, increment freq[num] by 1.result.freq array from index 1 to 1000.
freq[i] is equal to the length of nums, append i to result.result list.