can u help we understand this question with a recursion tree. I am getting confused . please explain with a example.
link ->geeksforgeeks.org/count-of-n-digit-numbers-whose-sum-of-digits-equals-to-given-sum/
can u help we understand this question with a recursion tree. I am getting confused . please explain with a example.
link ->geeksforgeeks.org/count-of-n-digit-numbers-whose-sum-of-digits-equals-to-given-sum/
@mikkyimran
see here you have to count total number of n digit numbers whose sum is y. In one step you can add 0-9 (except for first step where you can’t use 0). So let say we choose x from 0-9, then in next step we have to make number (y-x) with (n-1) digit. Base case of recursive step is
if(n==0){ check if sum is zero or not } and at same time if sum become zero simply return 0;
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.