Update appNew update is available. Click here to update.

Chocolate Fest

Last Updated: 27 Nov, 2020
Difficulty: Moderate

PROBLEM STATEMENT

Try Problem

Alex is taking part in a chocolate eating competition. There are ‘N’ boxes of chocolate numbered ‘0’ to ‘N - 1’. Each box contains some chocolates. The boxes are arranged in a line, with the box ‘0’ being the nearest to Alex. To win, Alex has to eat more than ‘X’ number of chocolates using minimum boxes. Alex can only eat chocolates from contiguous boxes. That is, he can choose some i and j (i <= j) and eat all the chocolates from box i, box i + 1, ..., box j. Alex is lazy, so if there are many optimal choices, he will choose the boxes nearest to him.

Given an array ‘choco’ containing the number of chocolates in each box, predict the boxes that Alex will choose. It is guaranteed that one such choice always exists.

Input Format:
The first line contains ‘T’, denoting the number of test cases.

The first line of each test case contains two integers, ‘N’ and ‘X’, denoting the number of boxes and the target, respectively.

The second line of each test case contains an array ‘choco’ of ‘N’ space separated integers, denoting the number of chocolates in each box.
Output Format:
For each test case, print an array of integers denoting the number of chocolates in the boxes that Alex will pick.
Note:
You are not required to print the expected output. It has already been taken care of. Just implement the function.
Constraints:
1 <= T <= 5
1 <= N <= 10^5
1 <= X <= 10^9
1<= choco[i] <= 10^4

Where ‘T’ is the number of test cases, ‘N’ is the number of boxes, ‘X’ is the target, and ‘choco[i]’ is the number of chocolates in the box ‘i’, where 0 <= i <= N - 1.

Time Limit: 1 sec