Showing posts with label number of paths. Show all posts
Showing posts with label number of paths. Show all posts

Saturday, January 27, 2018

Catalan number

January 27, 2018


Introduction


It is another mock interview and I had to work on the algorithm related to Catalan number. This time the peer dropped a hint, do not need to use previous row, only use current row and then save the space. I wrote the code based on his advice.

Algorithm 


Here is the code based on the advice from the peer.


Sunday, January 21, 2018

Catalan number

January 21, 2018

Introduction


It was another 10:00 PM mock interview again. I had to write the algorithm called catalan number. After I finished coding, the peer asked me if I can make an array copy instead of writing a for loop. So I looked up Array.Copy and then used it first time in mock interview.

Code review


Here is the C# code.

Wednesday, November 8, 2017

Catalan number

Nov. 8, 2017

I will write something here about the algorithm. Will come back very soon.

Transcript is here. I will write down the story later on.



Follow up 


January 17, 2018

It is the advantage of mock interview. I learned the algorithm after I had practive over a few times. But some one with very good talent on algorithm just showed me his way to solve the problem.

The peer just wrote down a 5 x 5 matrix using x to reprent each number, and then he went over the first row, to start from the first row from left to right, write down one for each column; and then go to next row, and then quickly from left to right, add the value underneath and left neighbor in the same row. He finished the process in less than 5 minutes, and then showed me the calculation of value for n = 4.

It is the best coaching experience for me. I learn that some one is much better than me to understand the algorithm. And after mock interview, the peer told me that he got some training in competitive programming before.