

1. In each arrangement, there is exactly one child at either end of the rope. This means one rope will be held by exactly two children.
2. No rope should cross any other rope.
The first line contains an integer ‘T’, which denotes the number of test cases to be run. Then, the 'T' test cases follow.
The first line of each test case contains a single integer, 'N'.
For each test case, print a single integer, denoting the total number of required arrangements. Since, the answer may be very large, print the answer modulo 10 ^ 9 + 7.
Output for each test case will be printed in a separate line.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N < 2 * 10^3
N is always even.
Where ‘T’ denotes the number of test cases and 'N' represents the total number of children.
Time Limit: 1sec
If the number of children on the left side is ‘X’, then the number of children on the right side will be ‘N - X - 2’. So, our problem breaks down into finding the ways for ‘X’ and for ‘N-2-X’ and multiplying them.
Note that ‘X’ can have multiple values and we need to find all possible arrangements so we need to sum up the number of ways for each value of ‘X’.
Algorithm is as follows:
Approach: We can observe that we are solving the same subproblems multiple times. This can be avoided if we store the answer for each subproblem somewhere. So, whenever we are asked to find the answer to a subproblem, we can simply look it up, and the answer has been already solved and stored, we do not require to solve it again, and we can simply return this answer. If the answer has not been solved earlier, then we solve the answer and store it for future use.
Algorithm is as follows:
Int findWays(N, memo) {
Approach: The approach is to use Bottom-Up Dynamic Programming to further optimize our solution. We can use an array and get rid of recursion which will make our solution more efficient. The idea is to use an array and store the values for all subproblems in this array and use the smaller values to find larger values.
Algorithm is as follows: