Piyush and magical park

Can you let me know am i missing any condition because my output isn’t coming right.Here is the code https://ide.codingblocks.com/s/171606

Hey @yath17 some conditions that you didn’t include are,

  1. if piyush is on the last element of the row you dont need to subtract energy taken for the step
  2. at every step you have to check if energy is greater than k or not
  3. you only need to print s when he is able to escape.
    Here is code with additional conditions: https://ide.codingblocks.com/s/171611
    Let me know if you face any problem.