Spiral Print Anticlockwise

Why all testcases are failing, even though the sample testcase is passed ?