Doubt in base case

check the video : ladder problem recursion: time 5:16

In base case he said , if (n==0 ){ return 1 } . why one ? why not zero?

the boy is already standing at the ground, so don’t need to go anywhere. som why did he return 1 and not 0?

video link: https://online.codingblocks.com/app/player/49396/content/151214/8193/lecture

hi @prateek_5
for the base case, we are considering that not having to jump is also a case, thats why 1 is returned. But if you are having confusion around this thing, you can also modify the base cases accordingly

yeah, it doesn’t affect the answer.
Thank you.

1 Like

@prateek_5 dont forget to mark your doubt as resolved :slight_smile:

1 Like