Problem Description
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.
First and only argument is an integer array A.
Return 1 if any such integer p is found else return -1.
Input 1:
A = [3, 2, 1, 3]
Input 2:
A = [1, 1, 3, 3]
Output 1:
1
Output 2:
-1
Explanation 1:
For integer 2, there are 2 greater elements in the array. So, return 1.
Explanation 2:
There is no such integer exists.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.