问题: 给定一个字符串,找到最长子串的长度,而不重复字符。 例子: 给定"abcabcbb"的答案是"abc",长度是3。 给定"bbbbb"的答案是"b",长度为1。 给定"pwwkew"的答案是"wke",长度为3.请注意,答案必须是子字符串,"pwke"是子序列,而不是子字符串。 解法一(超时 ...
分类:
其他好文 时间:
2017-09-28 14:14:57
阅读次数:
175
5. Longest Palindromic Substring 这个是在本机测试,然后一次点亮的,嘻嘻 1 char* longestPalindrome(char* s) { 2 char *p = s; /* first char */ 3 char *left, *right; /* sto... ...
分类:
其他好文 时间:
2017-09-28 11:34:44
阅读次数:
187
Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Input: [1,3,5,4,7] Output: 2 Explanation: The two l ...
分类:
其他好文 时间:
2017-09-27 21:48:07
阅读次数:
150
描述 Ming is going to travel for n days and the date of these days can be represented by n integers: 0, 1, 2, …, n-1. He plans to spend m consecutive da ...
分类:
其他好文 时间:
2017-09-25 21:57:14
阅读次数:
183
Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. 最开始的 ...
分类:
其他好文 时间:
2017-09-24 23:32:21
阅读次数:
271
中心扩散法 Spread From Center 复杂度 时间 O(n^2) 空间 O(1) 思路 动态规划虽然优化了时间,但也浪费了空间。实际上我们并不需要一直存储所有子字符串的回文情况,我们需要知道的只是中心对称的较小一层是否是回文。所以如果我们从小到大连续以某点为个中心的所有子字符串进行计算, ...
分类:
其他好文 时间:
2017-09-24 10:00:58
阅读次数:
223
521. Longest Uncommon Subsequence I【easy】 Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings ...
分类:
其他好文 时间:
2017-09-23 19:07:22
阅读次数:
120
class Solution { public int longestValidParentheses(String s) { int left=-1; Stack stack=new Stack(); int ret=0; for(int i=0;i<s.length();i++) { ... ...
分类:
其他好文 时间:
2017-09-23 13:41:19
阅读次数:
206
这道题为简单题 题目: 思路: 这个题很简单,直接两个变量m负责加数,p负责保存最大数 代码: ...
分类:
其他好文 时间:
2017-09-21 22:27:40
阅读次数:
230
http://acm.hdu.edu.cn/showproblem.php?pid=1403 题意:给出两个字符串,求最长公共子串的长度。 思路: 刚开始学后缀数组,确实感觉很难,但是这东西很强大,所以必须要学会它,推荐罗穗骞大牛的论文。 ...
分类:
其他好文 时间:
2017-09-21 22:22:33
阅读次数:
121