My code has a bug


moves for 36 should be 4 but it is showing 3, pls correct it for me and input is the same as in the video and I put it below the code
It’s the exact code trying to be executed in the video
Snake and ladder bfs 36

@sshreya2912 change this part according to the screenshot
image

Well if could explain why?

That still gives 3 for 36 https://ide.codingblocks.com/s/289498

@sshreya2912 you can dry run it and check! the source of snake is given first (ie its head) so update should be done at its head, but if you do it at e then the update will be done at its tail

I did what you said, it gives 3 for 36 https://ide.codingblocks.com/s/289498

I’ll check it, please wait

@sshreya2912 shreya your input is not correct, for the snakes part head comes first,
there are some other minor changes too, you can refer to this code https://ide.codingblocks.com/s/290920 for better understanding

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.