class Solution {public: string longestCommonPrefix(vector& strs) { int len = strs.size(); if(len == 0) return ""; string prefix = strs[0]; for(...
分类:
其他好文 时间:
2015-05-18 22:56:09
阅读次数:
144
题目描述
问题分析
代码
总结
个人声明题目描述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”, whic...
分类:
其他好文 时间:
2015-05-18 18:54:52
阅读次数:
99
http://poj.org/problem?id=3017
Description
Given an integer sequence { an } of length N, you are to cut the sequence into several parts every one of which is a consecutive subsequence of the ori...
分类:
其他好文 时间:
2015-05-18 16:52:11
阅读次数:
130
1. ~/.vimrc "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
set nocompatible
set autoread " 文件修改之后自动载入
set completeopt=longest,menu " 自动完成
set history=1000 "记录历史的行数
s...
分类:
系统相关 时间:
2015-05-18 16:23:20
阅读次数:
228
题意:
给你一个字符串,求该字符串的最长回文子序列长度。
解法:
以前做过连续最长回文子串的长度就是通过构造奇数偶数长度的来做,而本题是不连续。
注意到回文字符串的特点是从左边向右边看和从右边向左边看是一样的效果,那么就可以把目标字符串s导致后产生一个t,子串中如果t和s相同那么这个子串就是回文子串,那么就转化为这两个子串求LCS(longest common subsequent)的问题了。
我的...
分类:
其他好文 时间:
2015-05-17 13:46:04
阅读次数:
123
题目: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 farthest...
分类:
其他好文 时间:
2015-05-17 00:40:24
阅读次数:
126
Maximum Depth of Binary Tree
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 farthest leaf node....
分类:
其他好文 时间:
2015-05-16 20:38:48
阅读次数:
152
https://leetcode.com/problems/longest-valid-parentheses/Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the leng...
分类:
编程语言 时间:
2015-05-16 18:21:36
阅读次数:
289
题目描述:Find a longest common subsequence of two strings.输入:First and second line of each input casecontain two strings of lowercase character a…z. There...
分类:
其他好文 时间:
2015-05-16 18:13:58
阅读次数:
99
题意:
There is a array contain N(1
Every query will be:
1 x : ask longest substring which every number no less than x
2 y x : change the A[y] to x. there are at most change 10 times.
For each ask...
分类:
其他好文 时间:
2015-05-16 14:52:28
阅读次数:
121