码迷,mamicode.com
首页 >  
搜索关键字:longest valid parent    ( 12307个结果
[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 longest ...
分类:其他好文   时间:2014-07-22 23:16:14    阅读次数:408
shell脚本遍历目录及其下子目录
用shell写了个递归遍历目录的脚本,本脚本实现递归遍历指定目录,打印目录下的文件名(全路径)。#!/bin/sh function scandir() { local cur_dir parent_dir workdir workdir=$1 cd ${workdir} if [ ${w...
分类:其他好文   时间:2014-07-22 23:14:53    阅读次数:563
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...
分类:其他好文   时间:2014-07-22 23:11:32    阅读次数:388
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 le...
分类:其他好文   时间:2014-07-22 23:07:13    阅读次数:379
LeetCode OJ - Valid Palindrome
这道题挺简单的,但是需要细心。最好的方法是先对string做预处理,然后再判断是否是回文。下面是AC代码: 1 /** 2 * Given a string, determine if it is a palindrome, considering only alphanumeric ch...
分类:其他好文   时间:2014-05-01 01:45:34    阅读次数:375
序列最的问题之最长公共子序列LCS
在程序设计竞赛中,我们时常会遇到序列求最值的问题。在讲今天的问题之前,先小小的说明一下,子序列与子串的问题。 子序列:在原序列中不一定连续; 子串:在原序列中必须连续。 接下来,就开始今天要讲的最长公共子序列LCS(Longest Common Subsequence).对于LCS这一类的...
分类:其他好文   时间:2014-05-01 01:38:24    阅读次数:287
six solutions to a single symmetrical problem
Problem description:given a string, find the longest palindrome string in itSolution:1.brute force O(n^3)just enumerate start and end of the substring...
分类:其他好文   时间:2014-04-29 17:22:46    阅读次数:308
[Leetcode] Valid Number
Validate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the problem stat...
分类:其他好文   时间:2014-04-29 16:45:45    阅读次数:398
hdu 1595 find the longest of the shortest(dijstra + 枚举)
http://acm.hdu.edu.cn/showproblem.php?pid=1595 大致题意: 给一个图,让输出从中删除任意一条边后所得最短路径中最长的。。 思路: 直接枚举每条边想必是不行的。其实有些边是不需要枚举的,因为删除它们并不影响起点到终点的最短路。起作用的边都是未删边前的最短路径上的边,删除它们最短距离肯定增大,只需在这些最短距离中求最大的即可。 记录最短路...
分类:Web程序   时间:2014-04-28 10:24:42    阅读次数:393
CSU 1411: Longest Consecutive Ones
关键是通过预处理吧每个区间内的一移动到一起的最少步骤算出来.... 1411: Longest Consecutive Ones Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 185  Solved: 40 [Submit][Status][Web Board] Description Given a...
分类:其他好文   时间:2014-04-27 21:21:05    阅读次数:305
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!