Rat chases its cheese-doubt

code: https://ide.codingblocks.com/s/137170
why is the code giving run error ?

Hello @dvitiarora,

I have modified your code:

Refer to the comments for better understanding.

Hope, this would help.
Give a like, if you are satisfied.

@S18ML0016 the code is still giving run-error

Hey @dvitiarora,

This is because you have mistaken this question with rat in maze.
In this question, you can move up and down also.

I have modified your code:


Now, its passing all the testcases.

Hope, this would help.
Give a like, if you are satisfied.