1 题目:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longe...
分类:
其他好文 时间:
2015-06-05 15:31:51
阅读次数:
137
https://leetcode.com/problems/longest-common-prefix/原题:Write a function to find the longest common prefix string amongst an array of strings.思路:简单,直接遍...
分类:
其他好文 时间:
2015-06-03 19:02:16
阅读次数:
120
这个好多算法书上都有,不仅限于《算法导论》
时间限制:3000 ms | 内存限制:65535 KB
难度:3
描述
咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列。
tip:最长公共子序列也称作最长公共子串(不要求连续),英文缩写为LCS(Longest Common Subsequence)。其定义是,一个序列 S ...
分类:
其他好文 时间:
2015-06-03 15:54:35
阅读次数:
124
题目传送门 1 /* 2 题意:求最长括号匹配的长度和它的个数 3 贪心+stack:用栈存放最近的左括号的位置,若是有右括号匹配,则记录它们的长度,更新最大值,可以在O (n)解决 4 详细解释:http://blog.csdn.net/taoxin52/article/d...
分类:
其他好文 时间:
2015-06-03 15:11:51
阅读次数:
130
直接双重循环判断最大公约数,如果为1 就保存。用一个结构体保存值和对应数据。重载下#include#includeusing namespace std;struct T { int a[3]; double v;// T() {a[1] = '/';}}ans[13000];int n;int g...
分类:
其他好文 时间:
2015-06-02 10:38:31
阅读次数:
122
A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or
alphabetically, we...
分类:
其他好文 时间:
2015-06-02 09:28:13
阅读次数:
121
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For ...
分类:
其他好文 时间:
2015-06-02 09:24:48
阅读次数:
113
public class Solution { public int lengthOfLongestSubstring(String s) { if (s == null || s.length() == 0) { return 0; } ...
分类:
其他好文 时间:
2015-06-02 06:50:27
阅读次数:
110
这道题最大的问题是位置容易想不清楚public class Solution { public int longestValidParentheses(String s) { // http://blog.csdn.net/linhuanmars/article/details/...
分类:
其他好文 时间:
2015-06-02 06:47:55
阅读次数:
124
Java Longest Palindromic Substring(最长回文字符串)...
分类:
编程语言 时间:
2015-06-02 00:27:16
阅读次数:
326