码迷,mamicode.com
首页 >  
搜索关键字:longest ordered subs    ( 3212个结果
good-article.3--------Longest Palindromic Substring Part II
Given a string S, find the longest palindromic substring in S. Note: This is Part II of the article: Longest Palindromic Substring. Here, we describe an algorithm (Manacher’s algorithm) which...
分类:其他好文   时间:2015-01-14 15:40:50    阅读次数:326
Codeforces Beta Round #5 C. Longest Regular Bracket Sequence
经过了一个多月的时间,今天终于可以回到正轨了,继续开始刷CF。 题目大意: 给出一个只有括号的字符串,求最长“匹配”子串的长度和数量。 解题思路: 设置数组记录匹配括号段的开头。 下面是代码: #include #include #include #include #include #include #include #include #incl...
分类:其他好文   时间:2015-01-14 14:17:58    阅读次数:124
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. /** * Definition for binary tree *...
分类:其他好文   时间:2015-01-14 12:49:54    阅读次数:131
leetcode 14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.把输入strs当做二维数组,对每一列j, 检查strs[0...n-1][j]是否相同。 1 string longestCom...
分类:其他好文   时间:2015-01-13 19:38:59    阅读次数:144
Coincidence(LCS) 最长公共子序列问题
题目描述: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-01-13 19:37:52    阅读次数:180
leetcode5 Longest Palindromic Substring
求一个字符串的最长回文子串。回文子串分为两种,一种是aba型的,一种是abba型的,因此两种情况都有考虑到。用一个循环,对字符串中的每一个字符作为中心进行判断,并记录下每个循环后的最长子串。时间复杂度为O(n*n) 之前写了一个程序可以运行,但是在leetcode中运行超时了。下面的是修改别人的程序,很精简。 {CSDN:CODE:578916}...
分类:其他好文   时间:2015-01-13 17:53:08    阅读次数:166
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 ...
分类:其他好文   时间:2015-01-13 15:45:26    阅读次数:126
leetcode------Longest Common Prefix
这一段一直忙考试,一直没有刷题,今天上来刷三道题感觉生疏起来了。。罪过啊。刷到今天了。。还是没有写算法的感觉,还是写代码太少了。java的用法又忘记了很多。java上手后就要开始写python了,反正现在就是没有写代码的感觉。题目:Longest Common Prefix通过率:26.5%难度:简...
分类:其他好文   时间:2015-01-13 13:51:15    阅读次数:193
[LeetCode][Python]Longest Palindromic Substring
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/longest-palindromic-substring/Given a string S, find the ...
分类:编程语言   时间:2015-01-13 01:21:57    阅读次数:285
UVA1395 Slim Span(kruskal算法)
Slim Span [PDF Link] Given an undirected weighted graph G , you should find one of spanning trees specified as follows. The graph G is an ordered pair (V, E) , where V is a set of vertices {v1,...
分类:编程语言   时间:2015-01-12 22:37:21    阅读次数:391
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!