BETA

Difficulty Level:

Basic

Total Submissions: 2997 Accuracy:

34.53%

Find triplets with zero sum (Function Problem)
         

Given an array A[] of n elements. The task is to complete the function which returns true if triplets exists in array A[] whose sum is zero else returns false.

Input:
The first line of input contains an integer T, denoting the no of test cases. Then T test cases follow. The first line of each test case contains an integer N, denoting the number of elements in array. The second line of each test case contains N space separated values of the array A[].

 

Output:
For each test case in a new line output will be 1 if triplet exists else 0.

Constrains:
1<=T<=100
1<=N<=1000
-1000<=A[]<=1000

 

Example(To be used only for expected output) :
Input:

2
5
0 -1 2 -3 1
3
1 2 3
Output:
1
0

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth, Harshit Sidhwa


					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.