Count even length
Submissions: 4692   Accuracy:

21.77%

  Difficulty: Medium   Marks: 4

Given a number n, find count of all binary sequences of length 2n such that sum of first n bits is same as sum of last n bits.

Input:

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains the integer n.

Output:

Print the count of all binary sequences of length 2n such that sum of first n bits is same as sum of last n bits. Since the answer can be quite large print the answer modulo 109+7. Print the answer in a new line for each test case in a new line.


Constraints:

1<= T <=100

1<= N <=1000


Example:

Input: n = 1

Output: 2

There are 2 sequences of length 2*n, the

sequences are 00 and 11

Input:

n = 2

Output:

6

There are 6 sequences of length 2*n, the

sequences are 0101, 0110, 1010, 1001, 0000

and 1111

 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sujnesh Mishra
Author: sujnesh


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.