Sunday, January 28, 2018

Leetcode 54: Spiral Matrix

January 28, 2018

Introduction


It is the algorithm I have to write on my 10:00 PM mock interview. I worked on the spiral matrix, and it took me in total 20 minutes to explain the solution and write the solution to pass all test cases.

Code review


The peer told me that I can save the space using four pointers instead of visited array. I explained to him that the mock interview is for me to write the correct solution using minimum time.

Here is the C# code I wrote.

No comments:

Post a Comment