Monday, June 18, 2018

Leetcode 239: Slide window maximum (series 3 of 10)

June 18, 2018


Introduction


It is time for me to study discussion panel of the algorithm. I chose this one with keywords: Sliding window minimum/maximum = monotonic queue

Here is the discussion link. 


Mock interview talk 


I used the algorithm in my mock interviews a few times last 2 weeks. I had chance to discuss the algorithm with more detail. 

Of course, I like to write down some discussion and help me to develop good thinking process and reasoning skills with the interviewee. 


I did give hint about sliding window, do we have to make the sliding window fixed size? Can we think about the way to reduce the sliding window size? How to approach the problem?



When to add an element into the current sliding window, we can do comparison using current element to the last one in the window. 

No comments:

Post a Comment