Ensure that you are logged in and have the required permissions to access the test.
Aadesh has List of integers. In that list he wants to find the pivot index. The pivot index can be defined as the index where the sum of the numbers to the left of the index is equal to the sum of the numbers to the right of the index.
Further he wants that if there is no such index exists, he should get -1as the output and if there are multiple pivot indexes, he should get the left-most pivot index.
- The first line of the input contains an integer T denoting the number of test cases.
- Each test case will contain N space separated elements of List.
- If such index exist print the pivot index otherwise -1.
1 ≤ T ≤ 1000
1 ≤ N ≤ 2000
-1000 ≤ N[i] ≤ 1000