Leaderboard
Showing:
Nth catalan number
Easy Accuracy: 36.77% Submissions: 2915 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

Your Task:
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

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Nth catalan number

Output Window