码迷,mamicode.com
首页 >  
搜索关键字:longest consecutive    ( 3017个结果)
leetcode 3 Longest Substring Without Repeating Characters(滑动窗口)
用滑动窗口的思想来做。用一个unordered_map来查询之前的char有没有在现在的窗口中。class Solution {public: int lengthOfLongestSubstring(string s) { unordered_mapmp; int...
分类:其他好文   时间:2015-10-21 14:07:11    阅读次数:152
[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 fa...
分类:其他好文   时间:2015-10-21 12:03:10    阅读次数:161
leetcode笔记:Longest Common Prefix
题目的大意是,给定一组字符串,找出所有字符串的最长公共前缀。对比两个字符串的最长公共前缀,其前缀的长度肯定不会超过两个字符串中较短的长度,设最短的字符串长度为n,那么只要比较这两个字符串的前n个字符即可。...
分类:其他好文   时间:2015-10-20 01:26:43    阅读次数:202
LeetCode-3
题目: 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 ...
分类:其他好文   时间:2015-10-19 14:08:30    阅读次数:186
LintCode "Maximum Subarray Difference"
A variantion to "largest\smallest consecutive subarray". Idea is, at position i, the current max diff is max(max_left[i] - min_right[i+1], max_right[i...
分类:其他好文   时间:2015-10-18 14:01:57    阅读次数:174
Longest Run on a Snowboard
题意:n*m的矩阵,求矩阵中最长下降的序列的长度。分析:dp[i][j]表示以i,j为起点的最长下降序列,然后记忆化搜索。#include #include #include #include #include #include #include #include #include #include...
分类:其他好文   时间:2015-10-17 23:29:18    阅读次数:207
图论测试题(一)第一题:longest
第一题:longest乌托邦有n个城市,某些城市之间有公路连接。任意两个城市都可以通过公路直接或者间接到达,并且任意两个城市之间有且仅有一条路径(What does this imply? A tree!)。每条公路都有自己的长度,这些长度都是已经测量好的。小修想从一个城市出发开车到另一个城市,并且...
分类:其他好文   时间:2015-10-17 18:58:41    阅读次数:422
lintcode 容易题:Longest Words 最长单词
题目:最长单词给一个词典,找出其中所有最长的单词。样例在词典{ "dog", "google", "facebook", "internationalization", "blabla"}中, 最长的单词集合为["internationalization"]在词典{ "like", "...
分类:其他好文   时间:2015-10-17 17:36:08    阅读次数:209
lintcode 容易题:Longest Increasing Continuous subsequence 最长上升连续子序列
题目:最长上升连续子序列给定一个整数数组(下标从 0 到 n-1, n 表示整个数组的规模),请找出该数组中的最长上升连续子序列。(最长上升连续子序列可以定义为从右到左或从左到右的序列。)样例给定[5, 4, 2, 1, 3], 其最长上升连续子序列(LICS)为[5, 4, 2, 1], 返回4....
分类:其他好文   时间:2015-10-17 17:34:03    阅读次数:247
每每一看到自己的这段没通过的辛酸代码
Longest Valid ParenthesesMy SubmissionsQuestionSolutionTotal Accepted:47520Total Submissions:222865Difficulty:HardGiven a string containing just the c...
分类:其他好文   时间:2015-10-17 00:41:54    阅读次数:195
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!