G.W. Coding Contest 3 Tiebreaker: Largest Range
Given an positive \(\{\text{0} \leq x \lt 2^{31} \}\) integer array of length \(N\), return the largest possible range \(l\) to \(r\) inclusive in which the sum from \(l\) to \(r\) does not exceed \(K\)
The first line contains the integer \(N\), the length of the array, and \(K\), the value which the sum must not exceed, seperated by a space.
The second line contains each element of the array seperated by space.
\(\{\text{1 } \leq N, K, l, r \leq 10^6 \}\)
Output \(l\) and \(r\) seperated by a space
If there are multiple correct answers, the output should be the one which appears first. It is guaranteed there will be a correct answer.
Sample Input 1:
Sample Output 1:
Sample Input 2:
Sample Output 2:
Submit Solution