Piyush and Magical Park only 1 Test Case is Passing

Hello @MadHawk,

There are multiple issues with your code:

  1. You have to break out of both the loops, if the value of s becomes less than or equal to 0 and the current character is not ‘*’.
    This means that there is no scope of increment in the value of s.
    As you require positive value of s to move, thus you would stuck in the park.

  2. When # is encountered, you cannot move ahead.
    So, there is no meaning of decrementing s.

I have modified your code, you can check:

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

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.