leetcode整理 Stack
StudyCoder
这个作者很懒,什么都没留下…
展开
-
232. Implement Queue using Stacks
题目:用栈实现队列Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front转载 2016-07-23 10:32:24 · 187 阅读 · 0 评论 -
225. 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()转载 2016-07-23 11:31:34 · 249 阅读 · 0 评论 -
331. Verify Preorder Serialization of a Binary Tree
题目:验证二叉树的先序序列化One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel va转载 2016-07-23 15:59:12 · 298 阅读 · 0 评论 -
150. 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:转载 2016-07-24 10:46:06 · 183 阅读 · 0 评论 -
103. Binary Tree Zigzag Level Order Traversal
题目:二叉树之字形层序遍历Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For exam转载 2016-07-24 13:53:54 · 289 阅读 · 0 评论 -
155. 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(转载 2016-07-17 23:09:28 · 451 阅读 · 0 评论