Problem Description
Given an sorted array A of size N. Find number of elements which are less than or equal to B.
NOTE: Expected Time Complexity O(log N)
1 <= N <= 106
1 <= A[i], B <= 109
First agument is an integer array A of size N.
Second argument is an integer B.
Return an integer denoting the number of elements which are less than or equal to B.
Input 1:
A = [1, 3, 4, 4, 6] B = 4
Input 2:
A = [1, 2, 5, 5] B = 3
Output 1:
4
Output 2:
2
Explanation 1:
Elements (1, 3, 4, 4) are less than or equal to 4.
Explanation 2:
Elements (1, 2) are less than or equal to 3.
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.