Input: arr[] = {3, 0, 6, 1, 5}
Output: K = {1, 1, 2, 2, 3}
Explanation:
At index 1, there is 1 number greater than or equal to 1 in the array i.e. 3. So the K value for elements up to index 1 is 1.
At index 2, there is 1 number greater than or equal to 1 in the array i.e. 3. So the K value for elements up to index 2 is 1.
At index 3, there are 2 numbers greater than or equal to 2 in the array, i.e. 3 and 6. So the K value for elements up to index 3 is 2.
At index 4, there are 2 numbers greater than or equal to 2 in the array, i.e. 3 and 6. So the K value for elements up to index 4 is 2.
At index 5, there are 3 numbers greater than or equal to 3 in the array, i.e. 3, 6 and 5. So the K value for elements up to index 5 is 3.
Input: arr[] = {9, 10, 7, 5, 0, 10, 2, 0}
Output: K = {1, 2, 3, 4, 4, 5, 5, 5}