Not getting the Test case

Please explain the test case, I’m not getting how are we getting 13

Hi Ayush
In this question. you need to traverse the whole park.
After the end of the 1st row, the energy of Piyush is 16.
At the end of the 2nd row, energy is 13.
At the end of the 3rd row, energy is 16.
At the end of the 4th row, energy is 13.

Hence, we get the answer 13.

Shouldn’t the energy be calculated as -
20 - 2-2+5-2 - 4(as he has taken 4 steps, - 1 for each) =15 for the 1st row and so on

Only three steps were taken in first row not 4.

On what basis is the answer 13?

Hi Ayush

I already mentioned the output for each row above. Intially, Piyush is standing at (0,0) and take three steps (0,1) , (0,2), (0,3). Since (0,3) is the last coloumn, it automatically comes to (1,0) without counting any step as mentioned in the question as well.

So technically, Piyush is taking 3 steps for each row if he doesn’t encounter a #.

I got that part but how are we calculating the max strength?
Are we adding the strength gained at each ‘*’
Like -
+4 for the first star
+5 for the second(since there is no strength required for first step)
+4 for the third one
=13

Or is there any other logic?

https://drive.google.com/file/d/1grm15I8Bcl0tcLm27gzhETtDO9cK_Ub7/view?usp=sharing
Hope this helps.

Hi Ayush

As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.
Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.