Subarray with least average
Easy Accuracy: 29.76% Submissions: 6921 Points: 2

Find the subarray with least average of size K. Given an array arr[] of size n and integer k such that k <= n.

Input:
The first line contains an integer 'T' denoting the total number of test cases. In each test cases, the first line contains an integer 'N' and 'K' denoting the size of array. The second line contains N space-separated integers A1, A2, ..., AN denoting the elements of the array.

Output:
The first and last index of the subarray. (Index begins from 1).
Note: You may assume that there will only be one unique solution.

Constraints:
1 <= T <= 100
1 <= N <= 1000
1 <= K <= N
1 <= A[i] <= 103

Example:
Input:
1
3 1
30 20 10 

Output:
3 3

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.