Given an array A of distinct integers. The task is to find if there are two pairs (a, b) and (c, d) such that a+b = c+d, and elements of array are distinct.
Input:
First line consists of T test cases. First line of every test case consists of N, denoting the number of elements of array. Second line of every test case consists of elements of array.
Output:
Singple line output, print the 1 if pair exsits else 0.
Constraints:
1 <= T <= 200
1 <= N <= 105
1 <= Ai <= 106
Example:
Input:
2
7
3 4 7 1 2 9 8
7
65 30 7 90 1 9 8
Output:
1
0
Explanation:
Testcase 1: (3, 7) and (9, 1) are the pairs whose sum are equal.
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.
bruceewayne | 175 |
manvirag982 | 158 |
Core_Ka_Bachha | 137 |
yash_sharan | 136 |
rajupraaa1234 | 133 |
mr_kksparrow | 433 |
manvirag982 | 374 |
rajupraaa1234 | 268 |
Exception_404 | 254 |
PranathiBhuvanagiri | 242 |
blackshadows | 5331 |
Ibrahim Nash | 5219 |
akhayrutdinov | 5111 |
mb1973 | 4929 |
Quandray | 4567 |