I have been trying to solve this question but my solution is failing one test case and I am not able to figure out what is wrong with my solution.

Here is link to my solution, please help me in figuring out what is wrong with my solution.

I have been trying to solve this question but my solution is failing one test case and I am not able to figure out what is wrong with my solution.

Here is link to my solution, please help me in figuring out what is wrong with my solution.

Check your case 2 **" if (cranePosition < commands.length - 1) "** rather than** “command.length-1”** shouldnt it be** a.length-1** .