```java public String longestPalindrome(String s) { String rs = ""; int res = 0; for(int i = 0; i= 0 && s.charAt(i) == s.charAt(left)) left --; while(... ...
分类:
编程语言 时间:
2019-04-06 12:25:02
阅读次数:
170
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the lon ...
分类:
其他好文 时间:
2019-04-05 20:07:23
阅读次数:
186
```java public int lengthOfLongestSubstring(String s) { int i = 0, j = 0, max = 0; Set set = new HashSet(); while(j ...
分类:
编程语言 时间:
2019-04-05 14:03:33
阅读次数:
134
本题大意:和LIS一样 本题思路:用dp[ i ]保存前 i 个数中的最长递增序列的长度,则可以得出状态转移方程dp[ i ] = max(dp[ j ] + 1)(j < i) 参考代码: 1 #include <iostream> 2 #include <cstring> 3 #include ...
分类:
其他好文 时间:
2019-04-03 14:06:06
阅读次数:
152
题目要求 Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is ...
分类:
其他好文 时间:
2019-04-01 11:50:44
阅读次数:
137
使用l,r指针游动。 然后使用记录游动过程中的最大值。 我离散化了一下。 #include<stdio.h> #include<string.h> #include<algorithm> #include<iostream> #include<vector> #include<map> using ...
分类:
其他好文 时间:
2019-03-31 09:48:38
阅读次数:
164
description: Write a function to find the longest common prefix string amongst an array of strings. 找到几个字符串的最大前缀,英语不好是硬伤gg prefix string 前缀!!!!! If th ...
分类:
其他好文 时间:
2019-03-30 10:19:50
阅读次数:
152
problem 485. Max Consecutive Ones 参考 1. Leetcode_485. Max Consecutive Ones; 完 ...
分类:
其他好文 时间:
2019-03-29 19:08:28
阅读次数:
114
网址:https://leetcode.com/problems/length-of-longest-fibonacci-subsequence/ 其实就是斐波那契数列,没什么好说的。 注意使用3个变量,而不是数组,可以节约空间。 ...
分类:
其他好文 时间:
2019-03-28 00:32:21
阅读次数:
163
Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer ...
分类:
其他好文 时间:
2019-03-27 12:29:56
阅读次数:
157