This is my code
Whats wrong in code
hello @pranjalarora98
check now->
use count +1 in place of ++count because we will need previous value for second function call
why was i not taking with ++count?
return func(arr,i+1,sum+arr[i],n,++count) || func(arr,i+1,sum,n,count);
the first function { func(arr,i+1,sum+arr[i],n,++count) }call will increase the count value so in second function call {func(arr,i+1,sum,n,count); }incremented value of count will be passed which we dont wnt
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.