码迷,mamicode.com
首页 >  
搜索关键字:longest ordered subs    ( 3212个结果
Longest Valid Parentheses
将所有合法的括号即一对()都消除,用桟保存其中不合法的括号即单个(或)在字符串中的下标。那么每两个不合法之间的下标之差减1就是中间的合法串长度,依次从后向前比较,选出最大的字符串。 1 class Solution { 2 public: 3 int longestValidParenthe...
分类:其他好文   时间:2015-10-23 10:16:43    阅读次数:135
[LeetCode]32. Longest Common Prefix最长公共前缀
Write a function to find the longest common prefix string amongst an array of strings.解法:从所有的string的头到尾的字母逐一比较即可。class Solution {public: string lon...
分类:其他好文   时间:2015-10-22 12:28:49    阅读次数:187
[LeetCode]33. 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-10-22 12:04:38    阅读次数:148
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] Find Median from Data Stream 找出数据流的中位数
Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two...
分类:其他好文   时间:2015-10-21 08:08:47    阅读次数:317
[LeetCode] Find Median from Data Stream
Find Median from Data StreamMedian is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the m...
分类:其他好文   时间:2015-10-20 22:39:39    阅读次数:225
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
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!