stack
feeeeeeet
这个作者很懒,什么都没留下…
展开
-
Leetcode 20. Valid Parentheses
class Solution { public boolean isValid(String s) { char[] sc = s.toCharArray(); Stack<Character> par = new Stack<Character>(); for(int i = 0; i<s.length(); i++...原创 2018-11-14 09:20:25 · 75 阅读 · 0 评论 -
Leetcode 84. Largest Rectangle in Histogram
stack explaination(small mistakes in the graphs): http://www.cnblogs.com/lichen782/p/leetcode_Largest_Rectangle_in_Histogram.html class Solution(object): def largestRectangleArea(self, height): ...原创 2018-12-31 04:18:52 · 116 阅读 · 0 评论 -
Leetcode 85. Maximal Rectangle
same method to leetcode 84 reference: https://blog.csdn.net/doc_sgl/article/details/11832965 https://www.cnblogs.com/lupx/archive/2015/10/20/leetcode-85.html class Solution(object): def maximalRec...原创 2018-12-31 06:52:27 · 153 阅读 · 0 评论 -
Leetcode 94 & 102 & 144 & 145. Binary Tree Traversal (dfs & bfs)
stack # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def inorder...原创 2018-12-31 20:00:57 · 136 阅读 · 0 评论