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 ...
分类:
其他好文 时间:
2014-11-19 14:13:08
阅读次数:
149
Min Stack My SubmissionsQuestionSolutionDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Pu...
分类:
其他好文 时间:
2014-11-19 00:15:08
阅读次数:
271
Minimum Path SumGiven amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along ...
分类:
其他好文 时间:
2014-11-18 23:57:15
阅读次数:
231
题目描述: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...
分类:
编程语言 时间:
2014-11-18 23:14:32
阅读次数:
198
#include #include #include using namespace std;// 4 5 1 2// 1 2class Solution {public: int findMin(vector &num) { int len = num.size(); ...
分类:
其他好文 时间:
2014-11-18 01:35:47
阅读次数:
115
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.N...
分类:
其他好文 时间:
2014-11-17 01:39:53
阅读次数:
173
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.You m...
分类:
其他好文 时间:
2014-11-17 00:21:07
阅读次数:
213
1 package leetcode; 2 /* * 3 * 注意问题: 4 * 1. 原序列升序、降序问题,两种情况都要考虑 5 * 2. 边界问题,如果只有两个元素时要单独考虑,在num[mid]==num[left]判断中考虑 6 * 3. 采用2叉查找的思想 7 * */ 8 p...
分类:
其他好文 时间:
2014-11-17 00:19:52
阅读次数:
223
【题目】
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
For example, given s = "aab...
分类:
其他好文 时间:
2014-11-16 17:23:33
阅读次数:
158
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 ...
分类:
其他好文 时间:
2014-11-16 13:30:08
阅读次数:
174