33 单调栈
Previous443 String Compression & ctci189 1 point 6 String CompressionNext1673 Find the Most Competitive Subsequence
Last updated
Was this helpful?
Last updated
Was this helpful?
这是一种栈的诡异用法。当你需要知道当前值左/右边第一个比它大/小的值时,可以用这个栈。模板大概长这个样子:
(L122) ctci 17.21 -- relate:
- deserialize的非递归版本要用单调栈来把复杂度降低到O(n)