Catalan Number
Print the N-th Catalan number CN (C0 = 1, C1 = 1, C2 = 2, C3 = 5, ...). It counts balanced bracket strings, binary trees, and much more.
Input: one integer N.
Output: CN exactly (it fits in 64 bits for N ≤ 33).
Constraints:
- 0 ≤ N ≤ 33
Sample Tests
Input 1
3
Output 1
5
Input 2
0
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.