Hey folks,
Let’s discuss anything related to the SPIRAL MATRIX problem in this thread.

What are perf-tests

perf tests

They are performance tests with larger input.

But only one best time complexity is O(m*n) and I am using that.

It may not be failing because of TLE.
Try to check if your implementation works for a 5*5 matrix or larger.

My Code did not work for 5*5. I modified it and then it worked and then I got cleared all test cases.

can any one tell what may be wrong

Hint: Consider cases such as single row and single column. Does your code handle these correctly?

1 Like

My code works for 5x5 and 5x6 even 10x10 still i fail perf tests

thanks it solved my issue

Base test-3 and perf test-3 are failed during assignment. Tried for 2 hours but not able to solve it.
Tested with large inputs, it worked.Please help

This is a O(n*m) complexity question. Try matrices having different n and m. it might help ti identify wrong cases.

Try to decrease the complexity and remove uncertain steps.