[LeetCode] 032. Longest Valid Parentheses (Hard) (C++)...
分类:
编程语言 时间:
2015-03-13 16:35:05
阅读次数:
170
LeetCode_Longest Consecutive Sequence...
分类:
其他好文 时间:
2015-03-13 07:09:33
阅读次数:
172
(Version 0.0)这道题是在Palindrome Partitioning的基础之上要求找一个最少分割次数的partitioning,因为之前已经做过了Palindrome Partitioning,所以最开始自然想到了用DP记录所有substring是否是palindrome,然后再对每个...
分类:
其他好文 时间:
2015-03-13 07:04:57
阅读次数:
137
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 le...
分类:
其他好文 时间:
2015-03-13 00:14:25
阅读次数:
141
subString是String的一个方法,格式为:public String substring(int beginIndex, int endIndex)返回一个新字符串,它是此字符串的一个子字符串。该子字符串从指定的 beginIndex 处开始,一直到索引 endIndex - 1 处的字符...
分类:
其他好文 时间:
2015-03-12 23:50:18
阅读次数:
6456
1.字符串:string s1 = "test";string s2 = "test";string s3 = "test1".Substring(0, 4);object s4 = s3;Console.WriteLine("{0} {1} {2}", object.ReferenceEquals...
/** * 将15位转换为18位 * @param idCode 15位身份证号 * @return String 18位身份证号 */public String toEighteen(String idCode) { idCode = idCode.substring(0, 6) ...
分类:
编程语言 时间:
2015-03-12 15:03:01
阅读次数:
154
(Version 0.0)这题的思路比较straightforward,可以看出会有overlapping的子问题,因此可以先按DP做法用一个二维数组存储对于某一substring是不是palindrome的判断,然后做backtracking时可以利用这个DP二维数组的结果来跳过重复的palind...
分类:
其他好文 时间:
2015-03-12 11:07:43
阅读次数:
158
(Version 0.0)Interleaving String这道题是一道典型的DP题目,思路就是最基本的利用前一个subproblem(substring)的解加上对当前char的判断来解决当前问题的典型的sequence DP问题。我们要考虑的一般性的子问题是:取s1.substring(i)...
分类:
其他好文 时间:
2015-03-12 06:24:57
阅读次数:
172
题目要求:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The lon...
分类:
其他好文 时间:
2015-03-11 23:17:44
阅读次数:
155