Company: Barclays
Difficulty: medium
Number of Elements Less Than K Programming Language: C++14 (GCC 5.5.0) Given a list of integers together with a threshold value K, count how many entries in the list are strictly smaller than K. Note: You can use cout to debug your code. The code may not work in case of syntax/runtime error. Input Format The first line of the input consists of an integer - element_size , representing the number of elements in the list (N). The second line consists of N space-separated integers - element[1], element[2], ..., element[N] , representing the list of integers. The last line consists of an integer - num , representing the integer to be compared (K). Output Format Print a single non-negative integer giving the count of list entries that fall strictly below num . Constraints 10 2 ≤ num ≤ 10 9 10 2 ≤ element[1], element[2], ......., element[N] ≤ 10 9 Example Input: 7 1 7 4 5 6 3 2 5 Output: 4 Explanation: Scanning the list, the values below 5 are 1, 2, 3 and 4. That gives a count of 4, which is