码迷,mamicode.com
首页 >  
搜索关键字:longest substring    ( 5540个结果
[leetcode]Longest Common Prefix
Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.算法思路:思路:貌似木有什么捷径,逐个比较,遇到不同即断开。代码如下: 1 publi...
分类:其他好文   时间:2014-07-31 23:31:50    阅读次数:231
[leetcode]Maximum Depth of Binary Tree
Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root ...
分类:其他好文   时间:2014-07-31 23:19:10    阅读次数:259
Longest Consecutive Sequence
其实网上关于leetcode的题目的答案已经相当多了,这也是为啥我自己不把每道题目都贴出来的原因,觉得分析得没人好,代码也没别人的精简。不过,这道题目看到网上有不少做法跟实际要求的O(n)复杂度不太符合,所以特别粘贴出来,也正好记录下自己的一些想法。   说实话,在第二遍做这道题目的时候,我还是没能够把最为完善的解法想出来,能够想到的是利用hash表以序列值为key,1(只是简单做个标记)为v...
分类:其他好文   时间:2014-07-31 21:01:41    阅读次数:165
Maximum Depth of Binary Tree leetcode java
题目: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 farthes....
分类:编程语言   时间:2014-07-31 02:41:15    阅读次数:229
[LeetCode] Longest Consecutive Sequence(DP)
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 longes...
分类:其他好文   时间:2014-07-31 02:19:45    阅读次数:243
POJ 1631 Bridging signals & 2533 Longest Ordered Subsequence
两个都是最长上升子序列,所以就放一起了1631 因为长度为40000,所以要用O(nlogn)的算法,其实就是另用一个数组c来存储当前最长子序列每一位的最小值,然后二分查找当前值在其中的位置;如果当前点不能作为当前最长子序列的最大值,则更新找到值为两者间的较小值。2533 就是一个裸的最长上升子序列...
分类:其他好文   时间:2014-07-30 20:13:04    阅读次数:230
UVa Problem 10191 Longest Nap (最长打盹时间)
// Longest Nap (最长打盹时间) // PC/UVa IDs: 110404/10191, Popularity: B, Success rate: average Level: 1 // Verdict: Accepted // Submission Date: 2014-07-28 // UVa Run Time: 0.018s // // 版权所有(C)2014,邱秋。meta...
分类:其他好文   时间:2014-07-29 14:57:08    阅读次数:223
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...
分类:其他好文   时间:2014-07-29 14:28:48    阅读次数:218
[LeetCode] Palindrome Partitioning II (DP)
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ...
分类:其他好文   时间:2014-07-29 13:43:58    阅读次数:223
最长回文字串 (The longest palindrome substring)
这两天去学了一下,觉得下面那篇文章写的很好,有例子,比较容易懂,所以转一下。以下内容来自:hihoCoder:小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。这一天,他们遇到了一连串的字符串,于是小Hi就向小Ho提出了那个经典...
分类:其他好文   时间:2014-07-29 12:41:26    阅读次数:292
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!