Catalan Number Cn

Catalan Number Cn

Hard Computer Mathematics Trees & Counting 36 views
Explanation Complexity

Problem Statement

Compute the n-th Catalan number for n

Input Format

One integer n.

Output Format

One integer.

Example

4
14

Constraints

0

Input / Output Format

Input Format
One integer n.
Output Format
One integer.
Constraints
0

Examples

Input:
4
Output:
14

Example Solution (Public)

Computer Mathematics
Use formula Cn = (1/(n+1))*C(2n,n). Compute using integer nCr then divide by (n+1).

Official Solution Code

Use formula Cn = (1/(n+1))*C(2n,n). Compute using integer nCr then divide by (n+1).
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.