码迷,mamicode.com
首页 >  
搜索关键字:longest ordered subs    ( 3212个结果
#128 Longest consecutive sequence
两种方法: 先sort,再找。time complexity: O(nlogn)如果用array记录次数,space complexity是O(n)。如果只用int来记录current length以及longest length, space complexity 是O(1) 用hashset。T ...
分类:其他好文   时间:2018-11-10 15:29:52    阅读次数:116
#3 Longest substring without repeating characters
Sliding window Hashset Loop through every element inside the string. If the current char is not inside the hashset, push the char into the hashset and ...
分类:其他好文   时间:2018-11-10 15:04:19    阅读次数:189
[LeetCode] 559. Maximum Depth of N-ary Tree
Given a n-ary 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 ...
分类:其他好文   时间:2018-11-10 10:51:42    阅读次数:147
amazon coding questions
2016-10-181. Coding: very simple, like tree pre-order traversal 2. search a number in ordered array without knowing the array length 3. leetcode 53 4. ...
分类:其他好文   时间:2018-11-10 10:48:33    阅读次数:170
Tju_Oj_3517The longest athletic track
这个题主要考察对树的操作,主要思想是DFS或者BFS,其次是找树的直径方法(既要运用两次BFS/DFS),最后作为小白,还练习了vector的操作。 DFS框架伪码: vector的操作: 大意是给一个树,每个边的权重已知,求树的直径。 After a long time of algorithm ...
分类:其他好文   时间:2018-11-09 23:24:49    阅读次数:219
LightOJ 1224 - DNA Prefix - [字典树上DFS]
题目链接:https://cn.vjudge.net/problem/LightOJ-1224 Given a set of $n$ DNA samples, where each sample is a string containing characters from {A, C, G, T}, ...
分类:其他好文   时间:2018-11-09 22:56:18    阅读次数:288
POJ 3764 - The xor-longest Path - [DFS+字典树变形]
题目链接:http://poj.org/problem?id=3764 Time Limit: 2000MS Memory Limit: 65536K Description In an edge-weighted tree, the xor-length of a path p is define ...
分类:其他好文   时间:2018-11-09 00:48:00    阅读次数:204
562. Longest Line of Consecutive One in Matrix
https://leetcode.com/problems/longest-line-of-consecutive-one-in-matrix/solution/ Given a 01 matrix M, find the longest line of consecutive one in the... ...
分类:其他好文   时间:2018-11-08 18:32:34    阅读次数:216
LeetCode 5. 最长回文子串 Longest Palindromic Substring
题目: 给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为1000。 示例 1: 输入: "babad" 输出: "bab" 注意: "aba"也是一个有效答案。 示例 2: 输入: "cbbd" 输出: "bb" 题目: 给定一个字符串 s,找到 s 中最长的回文子串。你 ...
分类:其他好文   时间:2018-11-07 20:08:20    阅读次数:159
128. Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. Examp... ...
分类:其他好文   时间:2018-11-06 11:23:22    阅读次数:183
3212条   上一页 1 ... 54 55 56 57 58 ... 322 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!