Nth catalan number
Easy Accuracy: 49.71% Submissions: 18568 Points: 2

Given a number N. The task is to find the Nth catalan number.
The first few Catalan numbers for N = 0, 1, 2, 3, … are 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, …
Note:
Positions start from 0 as shown above.

Example 1:

Input:
N = 5
Output: 42


Example 2:

Input:
N = 4
Output: 14

Complete findCatalan() function that takes n as an argument and returns the Nth Catalan number. The output is printed by the driver code.

Expected Time Complexity: O(N).
Expected Auxiliary Space: O(N).

Constraints:
1 <= N <= 100

We are replacing the old Disqus forum with the new Discussions section given below.