- 博客(2)
- 收藏
- 关注
原创 单调栈问题
单调栈经典题:leetcode84,leetcode42,leetcode768单调递增栈可以找到左起第一个比当前数字小的元素。比如数组 [2 1 4 6 5],刚开始2入栈,数字1入栈的时候,发现栈顶元素2比较大,将2移出栈,此时1入栈。那么2和1都没左起比自身小的数字。然后数字4入栈的时候,栈顶元素1小于4,于是1就是4左起第一个小的数字。此时栈里有1和4,然后数字6入栈的时候,栈顶元素4...
2019-09-02 13:48:32
110
原创 leetcode72. Edit Distance
Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2.You have the following 3 operations permitted on a word:Insert a characterDelete a characte...
2019-08-30 19:16:55
83
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人