Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:
其他好文 时间:
2017-12-14 11:58:16
阅读次数:
91
1. 题目要求:找出字符串中的最大回文子串 2. 注意:要考虑回文子串中的字符个数是奇数还是偶数!!! 例如,“aabaa”是一个奇数个字符的回文字符串,他的中心只有一个字符“b”。 “aabbaa”是一个偶数个字符的回文字符串,他的中心却有两个相同字符“bb” 3. 思路:暴力解决,以每个字符为中 ...
分类:
其他好文 时间:
2017-12-14 00:05:59
阅读次数:
207
The idea is to use two arrays len[n] and cnt[n] to record the maximum length of Increasing Subsequence and the coresponding number of these sequence w ...
分类:
其他好文 时间:
2017-12-13 02:09:20
阅读次数:
115
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: 当然还有更逆天的算法,来自dis ...
分类:
其他好文 时间:
2017-12-13 00:07:17
阅读次数:
139
poj:Longest Ordered Subsequence 是一道简单的最长上升子序列问题 用下面的dp代码就可以轻松解决。 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 5 using namespace s ...
分类:
其他好文 时间:
2017-12-11 21:11:52
阅读次数:
181
Assume a is the longest edge, b and c are shorter ones, to form a triangle, they need to satisfy len(b) + len(c) > len(a). L: 这是return numbers, return ...
分类:
其他好文 时间:
2017-12-11 11:20:40
阅读次数:
125
The repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same consecutive substrings. For e ...
分类:
编程语言 时间:
2017-12-10 15:16:36
阅读次数:
177
给出两个字符串,找到最长公共子串,并返回其长度。 样例 给出A=“ABCD”,B=“CBCE”,返回 2 class Solution: """ @param: A: A string @param: B: A string @return: the length of the longest co ...
分类:
其他好文 时间:
2017-12-09 16:47:28
阅读次数:
175
A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[ ...
分类:
其他好文 时间:
2017-12-09 15:57:25
阅读次数:
167
Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts". The length of each ...
分类:
其他好文 时间:
2017-12-08 13:52:49
阅读次数:
234