Coldest Stretch
Daily temperatures are given. Find the starting day (1-based) of the K-day stretch with the smallest total temperature; on ties pick the earliest start.
Input: the first line has N and K; the second line has N integers (temperatures).
Output: the 1-based starting index of the minimum-sum window (earliest on ties).
Constraints:
- 1 ≤ K ≤ N ≤ 105
- −109 ≤ ai ≤ 109
Sample Tests
Input 1
6 2 5 1 1 4 0 3
Output 1
2
Input 2
3 3 1 2 3
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.