Problem of the day
Arr = 10, 5, 5, 6, 2,
In this array, the triplet {10, 5, 5} is valid triplet because, 5 + 5 = 10.
The elements in the array need not be distinct.
The first line of the input contains an integer T, denoting the number of test cases.
The first line of each test case contains the integer N, denoting the size of the array.
The second line of each test case contains N space-separated integers denoting the array elements.
For each test case, every line of output contains βtrueβ if there is a valid triplet and the user has returned a valid one, else "false" will be printed.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 50
1 <= N <= 10^3
1 <= Arr[i] <= 10^4
Time Limit: 1 sec
2
4
1 1 1 1
5
10 5 5 6 2
false
true
In the first case, no valid triplet can be formed.
5 5 10 is the triplet in which the sum of two elements {5,5} is equal to the third {10}.
2
6
1 2 3 1 2 3
6
1 1 2 2 1 1
true
true