Input: arr[] = {12, 4, 6, 13, 5, 10}, K = 3, L = 4, R = 10
Output: 5
Explanation:
Possible ways to select at least K(= 3) array elements having values in the range [4, 10] are: { (arr[1], arr[2], arr[4]), (arr[1], arr[2], arr[5]), (arr[1], arr[4], arr[5]), (arr[2], arr[4], arr[5]), (arr[1], arr[2], arr[4], arr[5]) }
Therefore, the required output is 5.
Input: arr[] = {1, 2, 3, 4, 5}, K = 4, L = 1, R = 5
Output: 6