码迷,mamicode.com
首页 >  
搜索关键字:longest    ( 2697个结果
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
leetcode3 Longest substring whitout repeat characters
求字符串中的最长无重复子串的长度,例如"abcabcbb",最长无重复子串为"abc",长度为3。因为要求无重复,因此想到要用HashMap来保存,因为HashMap的键值不能重复。将要存入的字符作为key,字符在字符串中的下标作为value,如果map中已经存有该字符,则删掉该字符以及字符串中该字符之前的所有字符,然后再存入。例如字符串为"abcbd",如已存入abc,现在要存b,则删掉ab,存...
分类:其他好文   时间:2015-01-12 11:38:25    阅读次数:217
[LeetCode][Python]Longest Substring Without Repeating Characters
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/Given a st...
分类:编程语言   时间:2015-01-12 01:36:33    阅读次数:255
LeetCode No.3 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 fo...
分类:其他好文   时间:2015-01-11 22:58:44    阅读次数:223
Longest Valid Parentheses
难点1,是栈,2是流程class Solution {public: int longestValidParentheses(string s) { stack mstack; char cbefore; int count = 0; if(s.empt...
分类:其他好文   时间:2015-01-11 12:14:33    阅读次数:119
[LeetCode#104, 111]Maximum Depth of Binary Tree, Minimum Depth of Binary Tree
The problem 1: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 t...
分类:其他好文   时间:2015-01-11 06:07:49    阅读次数:216
[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 longes...
分类:其他好文   时间:2015-01-09 22:08:16    阅读次数:178
spoj 1812
1812. Longest Common Substring IIProblem code: LCS2A string is finite sequence of characters over a non-empty finite set Σ.In this problem, Σ is the s...
分类:其他好文   时间:2015-01-09 22:06:32    阅读次数:339
LeetCode---Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. Solution: class Solution { public: string longestCommonPrefix(vector &strs) { vector s = strs...
分类:其他好文   时间:2015-01-09 09:17:16    阅读次数:122
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!