Little Deepu vs. Little Kuldeep
Practice
0 (0 votes)
Algorithms
Medium
Open
Approved
Mathematics
Problem
38% Success 240 Attempts 30 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Little Deepu and Little Kuldeep are the two best warriors in the realm of Westeros. But, their priorities and their loyalties are very much divided. Little Kuldeep fights for the right, just while Little Deepu fights for the wrong reasons, and supports the wrong ones in the kingdom. Everyone's scared of these two warriors getting into a fight ever. But, in the final match of the tournament for the best warrior in the kingdom, these two warriors will eventually have to face each other.

But, here's the twist. Since, everyone knows that these two are the best ones, no one wants them to die. So, it's a no-kill contest between them. They CANNOT kill each other. They just have to hit each other, with their best moves.

Both, Little Deepu and Little Kuldeep will get n chances to hit the opponent. But, since Little Deepu fights for the wrong people, he had the power to convince people that he'll be the attacker, and Kuldeep be the defender - that is to say. So, what will happen is the following: Little Kuldeep CANNOT attack Little Deepu before Little Deepu attacks him. Little Kuldeep can only retaliate to Little Deepu's hits, and NOT hit him before Deepu hits him.

That is to say, let's say both of them have 3 moves. So, a valid hitting combination would be:
1. DDDKKK
2. DKDDKK
And 3 other combinations.

So, ONLY after Deepu hits Kuldeep can hit him back!

So, you being a volunteer in managing the fights, have to figure out the number of valid combinations of the n hits by the both of them.

Input format:
The first line contains the number of test cases.
Every test case contains an integer N.

Output format:
You've to print out the number of valid combinations modulo by 1000000007.

Constraints:
1 <= Test Cases < 1001
1 <= N <= 1000000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
1 votes
Tags:
CombinatoricsMathematicsMediumOpenApproved
Points:30
2 votes
Tags:
CombinatoricsMathematicsMediumOpenApproved