Given an array of integers, we need to find out all possible ways construct non-degenerate triangle using array values as its sides. If no such triangle can be formed then return 0.
The first line of input contains an integer T. Then T test cases follow. First line of each test case contains an integer N denoting the size of array. Next line of the test case contains N space seperated integers.
For each test case output a single integer containing the count of all possible triangles that can be formed using the values from the array.
1 <= T <= 100
1 <= N <= 104
1 <= A[i] <= 104
5 4 3 1 2
10 15 30
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.