Showing posts with label Spiral array print. Show all posts
Showing posts with label Spiral array print. Show all posts

Wednesday, January 31, 2018

Leetcode 54: Spiral matrix

January 30, 2018

Introduction


It is such a big surprise that my first mock interview as an interviewer turns out big success. The peer solved all four algorithms I asked in first 40 minutes. He is the best peer I have met in my peers, over 150 peers.

Best thing is that I got education how to design a perfect system design: Instagram scalability in 30 minutes. I could not believe that I may interview a top company senior developer in the future.


Code review


Here is the C# code I like to learn. The idea is very clear and it is the production ready code.


Sunday, January 21, 2018

Advice to an undergraduate student

January 21, 2018

Introduction


It is not easy to give advice to a undergraduate student. I wrote down every practice I did, so I can easily relate to some statistics for each algorithm.

Spiral Array Copy


The peer worked on the algorithm. And also I tried to help but we could not finish it in 30 minutes. Here is the code.

After the mock interview, I just shared the fact. I have worked on the algorithm more than 50 hours.

Here is the sharing.


Sunday, September 3, 2017

Leetcode 54: Spiral Matrix

Sept. 3, 2017


Introduction


It is the classical medium level algorithm to write spiral matrix in one dimensional array. I have practiced more than 3 times. The key idea is to go over the four iterations from top row, last column, last row and first column, edge cases are one row or one column. last row and first column is optional because they are handled only if there are more than one row or more than two columns.

Compared to the practice in March of 2016, I am so happy to see that I can write more readable code.

Algorithm practice 


C# code is here. 

Feedback 



Saturday, June 13, 2015

Leetcode 54: Spiral Matrix | Code review | 2015 - 2023 | Long journey

June 11, 2015

Problem Statement
Recursive solution

The first study code is here. The second is here.

Iterative solution

The first study code is here. The second one is here. 
C# code to pass Leetcode online judge:

Julia's C# code practice in 2015

Follow up 


May 23, 2017

C# practice passes all test case. The code is here. Put one row and one column checking inside the for loop statement. Code is here.

Feb. 13, 2018

It is the early day I started to write coding blog to document my code practice. At that time, I was so shy and also afraid to write down my thinking process. I do not know myself even it is just three years ago.

I just wrote down two sentences, even the sentence is not complete. I chose to study two solutions and then I practiced one of them.

One thing I can tell now is that I did not pay attention to myself, how I think as a programmer, most likely I thought that coding is more important and also challenge.

The blogs I chose in 2015

Those algorithm blogs are well-written. I am surprised that I did not practice one by one in 2015.

The recursive solution is saved in the gist. Here is the link.
The solution based on directions is saved in the gist. Here is the link.
The solution based on directions and range is here.

Follow up 

July 4, 2023
I am so lucky to have chance to prepare for another phone screen from Meta in short future. I have chance to review my work history on this algorithm.