Piyush in magical park

what seems to be the problem with following code? It passes only 2 test cases at hackerblocks.

The program seems to be logically correct.

https://codeshare.io/5Q1Nmq

@vikanshu2016 his strength should always be greater than k. check if(s<k) or not at every step.

@vikanshu2016 if you don’t have any further queries mark this doubt as resolved.

but our main aim is to print whether he escapes with k strength or more otherwise no, so what is wrong if I escape the park completely and then compare the srength with k

@vikanshu2016 if at any point his strength gets lower than k he wont be able to move next step and hence never gets out of park. read the problem statement carefully.

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.