|All-time Popular Problems|
|Delete Middle of Linked List|
|Find all four sum numbers|
|Find first set bit|
|Element with left side smaller and right side greater|
|Smallest Positive missing number|
|Intersection Point in Y Shapped Linked Lists|
|Largest Number formed from an Array|
|Reverse an Array|
Given an unsorted array of non-negative integers, find a continuous sub-array which adds to a given number.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. The first line of each test case is N and S, where N is the size of array and S is the sum. The second line of each test case contains N space separated integers denoting the array elements.
Corresponding to each test case, in a new line, print the starting and ending positions of first such occuring subarray if sum equals to subarray, else print -1.
Note: Position of 1st element of the array should be considered as 1.
Expected Time Complexity: O(n)
1 ≤ T ≤ 100
1 ≤ N ≤ 100
1 ≤ an array element ≤ 200
1 2 3 7 5
1 2 3 4 5 6 7 8 9 10
In first test case, sum of elements from 2nd position to 4th position is 12
In second test case, sum of elements from 1st position to 5th position is 15