Problem p independent set

we have to take leaf node as base case right , but u haven’t defined any base case?.. then how function is returning the ans

hello @amit423raja
leaf node will not have any child therefore both loop written inside solve function will never run.
and in ur ans will be 1 ,or 2 if contraint is false which will act as base case.

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.