[ 1, 2, 7, 0, 9, 3, 6, 0, 6 ] for this test case there are 4 numbers 7,6,6,9 greater than 4. So, the function should return 1 but expected value is -1
As you see there are five numbers which are smaller than 4 [ 0 , 0 1 ,2 ,3 ] so answer is -1
Given an integer array **A** , find if an integer **p** exists in the array such that the number of integers greater than **p** in the array equals to **p** .
The question says you should look at the number of integers greater than the integer p not less than…
Actually, you are saying there are 4 integers greater but 4 isn’t in the array. Array should have 4 in it.
actually in some cases its taking no of distinct numbers greater than p and in some cases its taking no of elements in list that are greater than p