This isn’t passing a few test cases. Where am I going wrong in here?
Piyush and Magical Park
it is mentioned in the question that during entire journey piyush’s energy should not become less than equal to k so instead of comparing at end compare for every cell
Yeah it works now, thankyou. But how does that affect my output in anyway?
lets assume there is a test case in which there are lot of obstacles initially so many as to make the power less than zero then there are lot of beans so many to make the power greater than the minimum value required, if you check just at the end the power will be greater and you’d print the answer as yes but the answer would be no because at some point during journey power dropped below the minimum acceptable level
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.