码迷,mamicode.com
首页 >  
搜索关键字:longest substring    ( 5540个结果
LeetCode – Refresh – Longest Palindromic Substring
O(n2): 1 class Solution { 2 public: 3 string getP(string s, int start, int end) { 4 while (start >= 0 && end result.size()) result = s1;1...
分类:其他好文   时间:2015-03-20 08:05:24    阅读次数:123
LeetCode – Refresh – Longest Consecutive Sequence
It use the hashset to do the tricks. 1 class Solution { 2 public: 3 int longestConsecutive(vector &num) { 4 int len = num.size(), result =...
分类:其他好文   时间:2015-03-20 08:02:46    阅读次数:146
Longest Consecutive Sequence
https://leetcode.com/problems/longest-consecutive-sequence/Given an unsorted array of integers, find the length of the longest consecutive elements se...
分类:其他好文   时间:2015-03-19 21:38:49    阅读次数:164
LeetCode 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-03-19 06:23:34    阅读次数:126
LeetCode-3 Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:其他好文   时间:2015-03-18 22:59:37    阅读次数:170
leetcode 题解 || Longest Common Prefix 问题
problem: Write a function to find the longest common prefix string amongst an array of strings. 寻找 0 ~n 个字符串的最长公共前缀 thinking: (1)公共前缀很好理解,按位匹配即可 (2)很容易忘记处理0、1个字符串的情况。 code: string prefi...
分类:其他好文   时间:2015-03-18 18:05:15    阅读次数:112
Substring
Substring 时间限制:1000 ms  |  内存限制:65535 KB 描述 You are given a string input. You are to find the longest substring of input such that the reversal of the substring is also a substring of i...
分类:其他好文   时间:2015-03-18 14:11:43    阅读次数:118
NYOJ308 Substring (DP)
题目意思: http://acm.nyist.net/JudgeOnline/problem.php?pid=308 给定一个字符串s,求出s与其逆序串的最长连续字串。刚开始看成求最长回文字串的问题了,Wa~!这英语我也是醉了。。。喵分析: 将s逆转为ss,求s和ss的最长连续子序列即可。if(s[i-1]==ss[j-1]) dp[i][j]=dp[i-1][j-1]+1;AC代码:/**...
分类:其他好文   时间:2015-03-17 23:44:13    阅读次数:187
HDU 3308 LCIS(线段树区间合并)
Problem Description Given n integers. You have two operations: U A B: replace the Ath number by B. (index counting from 0) Q A B: output the length of the longest consecutive increasing subseque...
分类:其他好文   时间:2015-03-17 23:39:04    阅读次数:161
【LeetCode从零单排】No 3 Longest Substring Without Repeating Characters
题目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. Fo...
分类:其他好文   时间:2015-03-17 18:04:49    阅读次数:134
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!