
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Different ways to approach this problem. Perhaps store a boolean if you are moving up or down and a current column. Reverse the direction and increment the column every time you hits a wall.
Is there a way way to do this without storing state - by just using math?