Wednesday, January 3, 2018

Leetcode algorithm over 500 practice

January 3, 2017

Introduction


It is first mock interview in 2018. I had 10:00 pm mock interview, and I met a university graduate student, top ranking university. I spent two hours to work on mock interview, first 50 minutes we talked about situation, analysis and some sharing. And next 60 minutes or so I had chance to interview the peer.

Super performance


The peer has great performance. Here is the graph to show how a person can finish Leetcode algorithm over 500.



Here is the code the peer wrote, and it is the algorithm to find binary search tree inorder successor. The peer wrote iterative solution first, and then I asked a recursive solution, he wrote the recursive one in 10 minutes. He said that let me think about it, and in 1 - 2 minutes he wrote the correct solution.

Python code to write the algorithm similar to 4 sum is here.

So I have to look into the paid mock interview service market price. I have never tried before. Here is the one I like to try this year.

My performance


I was asked to merge two binary tree, and then I spent around 15 minutes to discuss and then I wrote the solution, and the peer gave me the comment to write clean code, simplify the logic.

His ideal code is here.

No comments:

Post a Comment