Arrays-spiral print clockwise

giving one test case wrong

Check your code for Testcase:
3 4
1 2 3 4
1 2 3 4
1 2 3 4
You’re not using the var count

yes for this test case i m printing on extra element , but i m not able to find out the error, as you mentioned it is error in the variable count, but i find it correct in my code as per my knowledge, if i m wrong please correct me , and tell me what is the exact error … THANKYOU

The last element is printing due to unmatched conditions of left and right vars.
I’m saying that you have initialized the count var but haven’t used it. Use it to break from all the conditions if count==0. Do count-- after every number print