I'm trying to print out the pascal triangle.
and this is a normal one
int pascal(int l, int n) {
if (l == n || n == 0)
return 1;
else
return pascal(l - 1, n) + pascal(l - 1, n - 1);
}
but I want to use only one pascal function for recursion like
int pascal(int l, int n) {
return pascal();
}
Is there any solution for given condition?
Yes, you can do by memoization because there is an overlapping subproblem.