码迷,mamicode.com
首页 >  
搜索关键字:longest substring    ( 5540个结果
最长上升子序列算法
这题目是经典的DP题目,也可叫作LIS(Longest Increasing Subsequence)最长上升子序列 或者 最长不下降子序列。很基础的题目,有两种算法,复杂度分别为O(n*logn)和O(n^2) 。A.O(n^2)算法分析如下:(a[1]...a[n] 存的都是输入的数)1、对于a...
分类:编程语言   时间:2015-01-07 18:26:49    阅读次数:280
java-Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given [100, 4, 200, 1, 3, 2], The longest consecutive elements sequence is [1, 2,...
分类:编程语言   时间:2015-01-07 16:52:23    阅读次数:141
[Leetcode] 5 - Longest Palindromic Substring
题目链接:https://oj.leetcode.com/problems/longest-palindromic-substring/ 这道题通常可以写出来的是2种做法。 1. 保持一个index从前往后扫,每次index的循环中,保持left和right的index向两边扫,但是有2种情况,aba和abba。left和right的扫描要扫2次 2. DP做法,2维矩阵 * 可以...
分类:其他好文   时间:2015-01-07 15:00:44    阅读次数:128
【Leetcode】Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given [100, 4, 200, 1, 3, 2], The longest consecutive elements sequence is [1, 2, 3...
分类:其他好文   时间:2015-01-07 10:58:06    阅读次数:191
leetcode 5.Longest Palindromic Substring
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:其他好文   时间:2015-01-06 23:07:00    阅读次数:208
囤位项目总结
基础:1.囤位参数是字符串格式,如"A5/R8/D3",其中第一个字母是舱位信息,第二个参数是舱位数量,用Substring来截取字符串信息,来比较舱等和数量。 public String substring(int beginIndex, int endIndex) 第一个int为开始的索引,对应...
分类:其他好文   时间:2015-01-06 19:40:01    阅读次数:128
跨表循环写插入sql语句
其实就是拼接sql 拼接出来的select 'INSERT INTO [Gas_CN_Trade_B2C].[dbo].[Common_Street] values ('+convert(varchar(20),ID)+','+StreetName+','''+''''+','+substring(...
分类:数据库   时间:2015-01-06 15:11:54    阅读次数:136
LeetCode:Longest Common Prefix
题目描述: Write a function to find the longest common prefix string amongst an array of strings. 代码: string Solution::longestCommonPrefix(vector &strs) { string result = ""; if(strs.size(...
分类:其他好文   时间:2015-01-06 12:03:24    阅读次数:137
【leetcode】 Palindrome Partitioniong (middle) (*^__^*)
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv...
分类:其他好文   时间:2015-01-06 11:37:18    阅读次数:91
[LeetCode] Longest Substring with At Most Two Distinct Characters及扩展
Given a string, find the length of the longest substring T that contains at most 2 distinct characters. For example, Given s = “eceba”, T is "ece" which its length is 3. 这题的线性解法是维护一个sliding w...
分类:其他好文   时间:2015-01-06 07:20:32    阅读次数:121
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!