spoj 1812 LCS2 - Longest Common Substring II 题意: 给出最多n个字符串A[1], ..., A[n], 求这n个字符串的最长公共子串。 限制: 1 <= n <= 10 |A[i]| <= 1e5 思路: 和spoj 1811 LCS几乎相同的做法 把当 ...
分类:
其他好文 时间:
2017-06-10 15:22:39
阅读次数:
157
Leetcode600 很简单的一道计数题 给定整数n 求不大于n的正整数中 二进制表示没有连续的1的数字个数 在dp过程中只要保证不出现连续1以及大于n的情况即可。 所以设计按位dp[i][j]表示到第i位 j=0表示第i位为0 且值等于n的情况 2为值小于n的情况 j=1表示第i位为1 且值等于 ...
分类:
其他好文 时间:
2017-06-10 14:01:21
阅读次数:
468
problem: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating l ...
分类:
编程语言 时间:
2017-06-09 14:12:32
阅读次数:
137
https://leetcode.com/problems/longest-palindromic-subsequence/#/description ...
分类:
其他好文 时间:
2017-06-09 10:01:11
阅读次数:
124
题目: 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 farthe ...
分类:
编程语言 时间:
2017-06-08 19:44:11
阅读次数:
110
Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest inc ...
分类:
其他好文 时间:
2017-06-08 13:09:04
阅读次数:
205
Given a positive integer n, find the number of non-negative integers less than or equal to n, whose binary representations do NOT contain consecutive ...
分类:
其他好文 时间:
2017-06-08 00:20:19
阅读次数:
294
Note: This question is good summary for this kind of problem. 1) Once you get the root, loop through all the children. Get the max up/down/max from th ...
分类:
其他好文 时间:
2017-06-07 10:15:22
阅读次数:
156
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */... ...
分类:
其他好文 时间:
2017-06-07 10:10:51
阅读次数:
114
Note: O(n) This question is the extension of the version one. The longest consecutive Sequence could be found in "Parent->Children" or "Children -> Pa ...
分类:
其他好文 时间:
2017-06-07 10:02:45
阅读次数:
149