

‘N’ = 3 ‘ARR’ = {1, 2, 3}
In this example, This is one possible way to construct a tree having one node as the root node, and 2 nodes at the first level, and 3 nodes at the second level. Hence the diameter of this tree is 5.
The first line contains a single integer ‘T’ denoting the number of test cases. Then each test case follows.
The first line of each test case contains an integer ‘N’ denoting the height of the binary tree.
The second line of the test case contains ‘N’ integers denoting the array ‘ARR’.
For each test case, print a single integer denoting the maximum possible diameter.
Output for each test case will be printed in a separate line.
You are not required to print anything; it has already been taken care of. Just implement the function and return the answer.
1 <= T <= 10
1 <= ‘N’ <= 1000
1 <= ‘ARR[i]’ <= 3000 where 2 <= ‘i’ <= ‘N’
ARR[0] = 1
Time Limit: 1sec
The steps are as follows: