stack
文章平均质量分 58
小榕流光
这个作者很懒,什么都没留下…
展开
-
[leetcode] 32. Longest Valid Parentheses 解题报告
题目链接:https://leetcode.com/problems/longest-valid-parentheses/Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring原创 2015-12-23 14:58:45 · 674 阅读 · 0 评论 -
[leetcode] 402. Remove K Digits 解题报告
题目链接:https://leetcode.com/problems/remove-k-digits/Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.N原创 2016-09-19 11:50:18 · 6393 阅读 · 0 评论 -
[leetcode] 388. Longest Absolute File Path 解题报告
题目链接: https://leetcode.com/problems/longest-absolute-file-path/Suppose we abstract our file system by a string in the following manner:The string "dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext" re原创 2016-08-24 08:53:58 · 6660 阅读 · 0 评论 -
[leetcode] 341. Flatten Nested List Iterator 解题报告
题目链接: https://leetcode.com/problems/flatten-nested-list-iterator/Given a nested list of integers, implement an iterator to flatten it.Each element is either an integer, or a list -- whose el原创 2016-04-10 10:01:05 · 4955 阅读 · 0 评论 -
[leetcode] 227. Basic Calculator II 解题报告
题目链接: https://leetcode.com/problems/basic-calculator-ii/Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *原创 2016-05-02 15:14:05 · 1031 阅读 · 0 评论 -
[leetcode] 84. Largest Rectangle in Histogram 解题报告
题目链接:https://leetcode.com/problems/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原创 2015-12-17 03:50:01 · 3617 阅读 · 0 评论 -
[leetcode] 135. Candy 解题报告
题目链接: https://leetcode.com/problems/candy/There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following r原创 2016-05-06 14:05:34 · 1331 阅读 · 0 评论 -
[leetcode] 155. Min Stack 解题报告
题目链接:https://leetcode.com/problems/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() -- Re原创 2015-12-28 10:35:17 · 465 阅读 · 0 评论 -
[leetcode] 225. Implement Stack using Queues 解题报告
题目链接:https://leetcode.com/problems/implement-stack-using-queues/Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element o原创 2015-12-28 17:20:11 · 499 阅读 · 0 评论 -
[leetcode] 103. Binary Tree Zigzag Level Order Traversal 解题报告
题目链接:https://leetcode.com/problems/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原创 2016-01-12 03:28:48 · 458 阅读 · 0 评论 -
[leetcode] 232. Implement Queue using Stacks 解题报告
题目链接:https://leetcode.com/problems/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原创 2015-12-29 12:25:42 · 496 阅读 · 0 评论 -
[leetcode] 150. Evaluate Reverse Polish Notation 解题报告
题目链接:https://leetcode.com/problems/evaluate-reverse-polish-notation/Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand m原创 2016-01-18 11:58:32 · 535 阅读 · 0 评论 -
求数组最大递增子串
题目描述: 给定一个数组, 对于每一个位置向前找不大于该位置的最长序列长度, 返回最长的一个序列长度, 该位置之前的序列不需要连续增长, 只要小于当前位置值即可. 例如: [1, 4, 2, 6], length[0] = 1, length[1] = 2, length[2] = 1, length[3] = 4.思路: 利用一个栈维护一个递减序列, 也就是如果当前元素小于栈顶元原创 2016-11-17 12:07:37 · 607 阅读 · 0 评论