CATALAN NUMBER PROBLEM

https://ide.codingblocks.com/s/434669,
can you please check this code and tell me that how to do this without using forloop?

hello @CODER_JATIN

	for(int i=1;i<=n;i++)
	{
		curr_ans=curr_ans+noOfSubtrees(i-1)*noOfSubtrees(n-i);
	}

without for loop its not possible.
but u can improve ur code.
notice that the recursive problem has overlapping subproblem
so u can use one additional array to memoise the result.
this will make ur program fast.

matlab array mai value index wise store krta rahu?

ha, jaise hum top down dp mein karte hai waise

thik hai bhaiya karle dekhta hu

karke* …

And bhaiya ye lower_bound() and upper_bound() function btana ek baar

lower_bound(x) return karega iterator of element y.
such that x<=y

upper_bound(x) return karega iterator of element y.
such that x<y

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.