Given an array a of N positive and negative numbers. Find if there is a subarray (of size at-least one) with 0 sum.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the size of the array. The next line contains N space separated integers forming the array.
Print "Yes" ( without quotes) if there exist a subarray of size at least one with sum equal to 0 or else print "No" ( without quotes).
This is a function problem. You only need to complete the function subArrayExists() that takes array and n as parameters and returns true or false.
1 <= T <= 100
1 <= N <= 104
-105 <= a[i] <= 105
4 2 -3 1 6
4 2 0 1 6
Testcase 1: 2, -3, 1 is the subarray with sum 0.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.