Test case fails piyush and magical park

@Vikaspal this code has syntax errors, please correct those first. Make sure your code is running for sample input before you submit it.

@Ishitagambhir i actually send ur the thread.


3 test case fail working fine for the give input

@Vikaspal place a check to break the loop as soon as strength becomes less than k, you are checking it at the very end only, but you have to check before each step

@Ishitagambhir i didn’t get ur are saying like if the strenght is become less than k at any point we have to break the loop. but what about the case when in other cell we have the * which is going to increase the strength. so how we can conclude that if the strength is less than k then we have to break the loop??

@Vikaspal you cannot go to the next cell if you dont have strength in the first place

@Ishitagambhir got it

1 Like

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.