Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is...
分类:
其他好文 时间:
2015-02-16 20:58:05
阅读次数:
180
Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig...
分类:
其他好文 时间:
2015-02-16 15:32:54
阅读次数:
133
问题及代码:
Problem Description
How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must ...
分类:
其他好文 时间:
2015-02-15 13:33:05
阅读次数:
205
搜索树数据结构支持多种动态集合操作,包括SEARCH、MINIMUM、MAXIMUM、PREDECESSOR、SUCCESSOR、INSRT和DELETE操作等。基本的搜索树就是一棵二叉搜索树。12.1什么是二叉搜索树1. 二叉搜索树的性质:设x是二叉搜索树中的一个结点。如果y是x左子树中的一个结点...
分类:
编程语言 时间:
2015-02-14 22:27:38
阅读次数:
351
Given a binary tree, find the maximum path sum.
The path may start and end at any node in the tree.
For example:
Given the below binary tree,
1
/ \...
分类:
其他好文 时间:
2015-02-14 15:02:11
阅读次数:
198
<!--<!DOCTYPEhtml><html><head><metacharset="UTF-8"><metaname="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><linkrel="stylesheet" href="../../../ui/jquery.mobile-1.4.5/jquery.mobi..
分类:
移动开发 时间:
2015-02-14 01:23:36
阅读次数:
307
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
这道题是求一个二叉树的深度。题目中对深度的定义是:从根节点到叶节点依次经...
分类:
其他好文 时间:
2015-02-13 21:15:47
阅读次数:
156
题目:给定长度为n的整数数列 a0,a1,...,an?1a_0,a_1,...,a_{n-1}以及整数S,求出总和不小于S的连续自序列的长度最小值。如果不存在,则输出0样例:输入
n = 10
S = 15
a = {5 , 1,3 ,5 ,10,7,4,9,2,8}
输出
2 (5 ,10)思路:尺取法通常的是保留数组的一对下标(开始到结束),然后根据实际情况交替移动。我们假设从i开...
分类:
其他好文 时间:
2015-02-13 16:39:24
阅读次数:
235
标题:Maximum Subarray通过率:34.5%难度:中等Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, ...
分类:
其他好文 时间:
2015-02-13 13:02:34
阅读次数:
162
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [?2,1,?3,4,?1,2,1...
分类:
其他好文 时间:
2015-02-12 20:06:06
阅读次数:
216