Company: Buyhatke_30march
Difficulty: medium
An Array of Numbers Problem Description There is an array of numbers A of length n. Return an array whose i-th element contains the smallest number other than itself that occurs as least as many times as the i-th number in array A. If there is no number that occurs as many times as the i-th element then let that number in the returned array be -1. Input Format: The first line contains n, the length of array A. The next n line contain the elements of array A. Output Format: Return an array as asked in the problem Constraints 1 <= n <= 10^5 1 <= A_i <= 100 Examples Example 1: Input: 10 3 3 3 2 1 1 2 3 3 4 Output: -1 -1 -1 1 2 2 1 -1 -1 1 1 Explanation: For the first, second, seventh, and eighth elements, the number in array A is 3 which occurs 4 times, and there is no number that occurs at least four times other than 3 itself. So the corresponding element in the returned array is -1. For the third, and sixth elements, the number in array A is 2 which occurs 2 times, and 1 is