C++ python用monotonic stack解Leetcode 739 daily temperatures。Stack在程式設計、資料結構的課會教,但monotonic stack就不一定了。Leetcode 739 daily temperatures,題目問天氣要等幾天才會變暖,當然迴圈可用倒序,這個確定後,當然要確保堆疊的頂端所代表的溫度大於temperatures[i]...
Stack is taught in programming and data structure lectures, but monotonic stack is not necessarily taught. Leetcode 739 daily temperatures, the question asks how many days it will take for the weather to warm up. Of course, the loop may be proceeded in reverse order. After this is determined, of course, it must be ensured that the temperature represented by the top of the stack is greater than temperatures[i]...
[codes on Leetcode]https://leetcode.com/problems/daily-temperatures/solutions/4651708/array-stack-implement-monotonic-stack-52ms-beats-100/
[Leetcode playList]https://www.youtube.com/watch?v=KHVXYo7LxZE&list=PLYRlUBnWnd5IdDHk2BjqXwesydU17z_xk
[Dynamic Programming Playlist]https://www.youtube.com/watch?v=30yq3fmE6E8&list=PLYRlUBnWnd5K_XYUesV9oc6M9ONXII61T
沒有留言:
張貼留言