#K56627. Longest Contiguous Temperature Subarray
Longest Contiguous Temperature Subarray
Longest Contiguous Temperature Subarray
You are given a list of temperatures recorded over n days, and two integers l and r defining an inclusive temperature range. Your task is to determine the length of the longest contiguous subarray in which every temperature lies within the range \([l, r]\).
Example: If n = 10, l = 15, r = 25 and the temperature array is [10, 20, 19, 22, 23, 26, 25, 30, 17, 25], then the longest contiguous subarray with temperatures within \([15, 25]\) is of length 4.
The input is read from standard input (stdin) and the result must be printed to standard output (stdout).
inputFormat
The first line of input contains three space-separated integers: n
(the number of days), l
(the lower bound), and r
(the upper bound) respectively.
The second line contains n
space-separated integers representing the temperatures for each day.
outputFormat
Output a single integer which is the length of the longest contiguous subarray such that every temperature lies in the range \([l, r]\).
## sample10 15 25
10 20 19 22 23 26 25 30 17 25
4