Count smaller elements in sorted array in C++
Given a sorted array and a number x, count smaller elements than x in the given array. Examples: Input : arr[] = {10, 20, 30, 40, 50} x = 45 Output : 4 There are 4 elements smaller than 45. Input : arr[] = {10, 20, 30, 40, 50} x = 40 Output : 3 There are 3 elements smaller than 40. We can use upper_