Introduction
So I had a chat with my coach at 8:00 AM and talked about 60 minutes. We did talk about stack, minimum heap, and argued a few thing about it is not wise to delete a node in minimum heap which may not be the root node.
Sometimes, I like to have something and then could not keep the cool. I drove to work still thinking about the algorithm from preprocessing O(1) to selection sort O(k).
Talk to coach and good time to communicate
Hard level algorithm
I remember one time my mock interviewer told me that the hard level algorithm is biased. It will not be fair for the person who does not work on the algorithm, or for my case I have not reviewed it last 3 weeks. So that is the reason people tend to move away a little bit on that.
Follow up
June 19, 2018
This morning another algorithm expert just quickly gave the good solution using dequeue, and explained to me how to handle the moving data structure like sliding window keep ascending order. Pruning is to remove those outside of ascending order since it can be minimum at all. Repeat three keywords for the algorithm, slide window and ascending order, pruning those impossible minimum nodes as quick as possible.
I worked on the algorithm before, I just could not recall the algorithm right away. Also the friend is very open to minimum heap idea, and he said that it can be customized and fit for the need. I really like his attitude and he will be definitely a good engineer.
Follow up
June 12, 2018
Leetcode 239 Sliding Window maximum
My submission history:
using dequeue
My C# practice over 12 months ago
C# code using LinkedList class is here.
using SortedSet
11 months 2 weeks ago, C# code is here.
No comments:
Post a Comment