Catalan Numbers 1 test case giving wa

my code : https://ide.codingblocks.com/s/238290

ques : https://hack.codingblocks.com/app/contests/1463/914/problem

the last test case is giving wrong ans, pls tell me the error in my code, it seems fine to me.

I didn’t get ur approach.
The recurrence is: for( int i=0; i<n; i++)

res += catalan(i)*catalan(n-i-1);

i am using the direct formula to calculate nth catalan no ,i.e, 2nCn/(n+1) (2nCn is binomial coefficient)

I didn’t get ur recursive case. What are u trying to do?

i m not using recursion , instead i m using the direct formula as mentioned above