Which is better? Using n == 1 as a base case to prevent another call on the stack or using n == 0.
Base case doubt
It depends. Sometimes you need to return different values for both the base cases i.e. n== 0 and n == 1 . In that case , you don’t have a choice. Else, you can keep the base case as 0 but make sure the function never enters with a negative value else it may create unexpected results.
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.