Stack
文章平均质量分 77
cgdong2014
这个作者很懒,什么都没留下…
展开
-
Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get转载 2015-01-08 04:30:15 · 241 阅读 · 0 评论 -
Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another expression. Some examples: ["2", "1", "+原创 2015-01-11 06:57:08 · 230 阅读 · 0 评论 -
Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the longest valid parentheses substring is "()", wh原创 2015-01-08 13:27:25 · 187 阅读 · 0 评论 -
Implement Stack using Queues
Implement the following operations of a stack using queues. push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Return whet原创 2015-08-02 11:07:42 · 265 阅读 · 0 评论 -
Largest Rectangle in Histogram
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram. Above is a histogram where width of ea原创 2014-10-16 13:03:59 · 241 阅读 · 0 评论