Catalan Number

Easy
0/40
profile
Contributed by
7 upvotes
Asked in companies
AmazonGoogle inc

Problem statement

You are given an integer n. Your task is to find the nth catalan number. nth Catalan number is defined using following expression:

Alt Text

Detailed explanation ( Input/output format, Notes, Images )
Input Format:
The first line of input will contain T(number of test cases), each test case follows as.
Next T lines contain an integer n.
Constraints:
1 <= T <= 10^4
0 <= n < 10^3
Output Format:
For each test case. print the answer in a new line.
Since answer can be pretty huge print its modulo with 10^9 + 7
Sample Input:
2 
0
2
Sample Output:
1
2
Catalan Number
Full screen
Console