解Leetcode 907. Sum of Subarray Minimums,用了DP動態規劃以及Monotonic stack,可以得到線性時間解,如果直接解,那可是O(n^3)時間,有好方法當然要會用
DP動態規劃與monotonic stack單調堆疊解Leetcode 907 Sum of Subarray Minimums
[codes on Leetcode]https://leetcode.com/problems/sum-of-subarray-minimums/solutions/4595290/c-python-dp-monotonic-stack-23ms-beats-100/
[Leetcode playList]https://www.youtube.com/watch?v=KHVXYo7LxZE&list=PLYRlUBnWnd5IdDHk2BjqXwesydU17z_xk
沒有留言:
張貼留言