Getting wrong output

in top down approach reaching to 1 from 5 is 5->4->2->1
three steps
in bottom up it should be 3 again…but whatever code has been explained in the video gives 4 as the output and prateek sir also got the same output…plzz check to that

hello @PoojaSingh22

there is mistake in bottom up video.
inside loop it should be i in place of n.

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.