Test-case 3 of Anti-clockwise spiral print

Question: https://online.codingblocks.com/app/player/178555/content/173727/4817/code-challenge

My solution: https://ide.codingblocks.com/s/404009

Getting wrong answer for Test-case 3.

Hello @mohaktrivedi i have corrected your code and i have commented the mistake:


if you have any doubt you can ask here:
Happy Learning!!

@Tushar Thanks! Can you please explain ‘why’ was it wrong?

@mohaktrivedi dry run your code for this test case:
2 6
1 2 3 4 5 6
10 11 12 13 14 15
you will understand what was wrong.
if you have any doubt you can ask here:
Happy Learning!!

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.