Saturday, August 4, 2018

40 algorithm two weeks drill

August 4, 2018

Introduction


It is two weeks Leetcode easy level algorithms drills. I had the drill from July 10 to July 31, and then I had chance to work on more than 40 algorithms, most of them are easy level, a few of them are hard level. All two algorithms asked in 45 minutes was in those 40 algorithms.

My research topic is why I still fail to answer the first one. How should I learn to cover my nervousness first a few minutes on the algorithm?

Here is my github folder including all my practice. Here is the blog about the algorithm I practice in July 30. 2018.


Possible reasons


I think that I should be able to explain why I am selected first. And then I should stay confident and perform the best I can.

The algorithm is called merge k sorted lists. The time complexity is lowered down by apply master theorem, divide and conquer. The minimum heap is same time complexity using merge sort to solve the algorithm called merge k sorted lists. I was asked this algorithm more than three years ago by another company as well.

I should learn to define several options first, preprocessing allowed/ not allowed, one iterator has to be called using HasNext or Next, extra space should be used or not, how big the space can be allowed, space O(1) or O(N), define a few variables in the problem and try to estimate possible upper bound of the algorithms.

Actionable Items


I like to have another two weeks drills, work on Leetcode easy level algorithms.

I need to do research how to approach a problem I have not seen before. The interviewer also tries to identify if you see the problem before. Next time I should be happy because I have not seen the problem before. Right now it is the perfect for the interview algorithm. Choose not to be nervous instead of happy. Just apply normal analysis I can and then use some kind of structure to approach the problem.

Follow up


August 5, 2018 10:08 PM
一道题有很多解法。 iterator其实就是一个单链表。
可以从时间复杂度讲起。

HasNext O(1) -> O(m)
Next -> O(1) -> O(logm) -> O(m)



No comments:

Post a Comment