给定两个串,S和T,在S中找到包含T的最短子串,如果不能包含,返回空字符。Given a string S and a string T, find the minimum window in S which will contain all the characters in T in compl...
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov...
分类:
其他好文 时间:
2014-11-15 23:12:56
阅读次数:
193
Similar with version I, but analysis is different. With the possibility of duplication, only ">" indicate a definite case of next search space.class S...
分类:
其他好文 时间:
2014-11-15 16:56:14
阅读次数:
201
There's usually a common strategy for "find *" problems - binary search: half the space can be dropped by some rules.And take care of corner cases.cla...
分类:
其他好文 时间:
2014-11-15 16:53:56
阅读次数:
171
Leetcode更新到155题了,这个easy的题acceptance却不高,我好奇的点开了它。Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(...
分类:
编程语言 时间:
2014-11-14 19:24:03
阅读次数:
240
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-13 20:50:45
阅读次数:
197
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...
分类:
其他好文 时间:
2014-11-13 18:07:10
阅读次数:
212
/**
* Definition for binary tree
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {
publi...
分类:
其他好文 时间:
2014-11-12 13:49:37
阅读次数:
169
题目链接:
huangjing
思路:新学会的一种算法,RMQ(Rangle Minimum Query)从名字来看,觉得就是查询最小值的,哈哈,
大白上有仔细的讲解。dp[i][j]=min(dp[i][j-1],dp[i+(1
预处理的复杂度为O(N*logN),查询就是O(1)的复杂度。
方法二:线段树解法 复杂度为O(Q*logN).
题目:
题目1 : R...
分类:
编程语言 时间:
2014-11-11 22:52:52
阅读次数:
187
问题描述:
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.
For example, given the following triangle
[
[2],
[3,4...
分类:
其他好文 时间:
2014-11-11 21:09:06
阅读次数:
207