A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the ...
分类:
其他好文 时间:
2016-11-13 17:02:55
阅读次数:
259
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 l ...
分类:
其他好文 时间:
2016-11-13 07:49:37
阅读次数:
170
Description Given two strings, you have to tell the length of the Longest Common Substring of them. For example: str1 = banana str2 = cianaic So the L ...
分类:
编程语言 时间:
2016-11-10 02:09:11
阅读次数:
233
这道题是让求最长回文字符解法有三 1.暴力解法 时间复杂度O(n3) 代码: 解法二 从字符中间向两边蔓延 时间复杂度o(n2) 代码: 解法三 动态规划 主要是设置一个二维数组,长度均为字符串长度,然后已经检测的设置为true,这样就免去了重复检测已检测的字符 时间复杂度o(n2) 代码: 还有一 ...
分类:
其他好文 时间:
2016-11-09 11:01:42
阅读次数:
186
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 l ...
分类:
其他好文 时间:
2016-11-05 17:28:13
阅读次数:
147
注意最长公共子串(Longest CommonSubstring)和最长公共子序列(LongestCommon Subsequence, LCS)的区别:子串(Substring)是串的一个连续的部分,子序列(Subsequence)则是从不改变序列的顺序,而从序列中去掉任意的元素而获得的新序列;更 ...
分类:
其他好文 时间:
2016-11-04 14:24:17
阅读次数:
200
题目链接:http://lightoj.com/volume_showproblem.php?problem=1278 题意:给你一个数n(n<=10^14),然后问n能用几个连续的数表示; 例如: 15 = 7+8 = 4+5+6 = 1+2+3+4+5,所以15对应的答案是3,有三种; 我们现在 ...
分类:
其他好文 时间:
2016-11-03 16:08:15
阅读次数:
501
Problem: 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 f ...
分类:
其他好文 时间:
2016-11-03 09:30:34
阅读次数:
171
Write a function to find the longest common prefix string amongst an array of strings. 思路:要去是寻找字符串vector里最长的公有前缀。 1。构造迭代器,遍历vector搜索最小string长度。然后从第一个字 ...
分类:
其他好文 时间:
2016-11-02 23:04:01
阅读次数:
125