码迷,mamicode.com
首页 >  
搜索关键字:longest palindromic    ( 2914个结果
409. Longest Palindrome
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This ...
分类:其他好文   时间:2018-11-16 17:43:50    阅读次数:116
【LeetCode】并查集 union-find(共16题)
https://leetcode.com/tag/union-find/ ...
分类:其他好文   时间:2018-11-15 17:07:47    阅读次数:253
【2018-11-14】初级脚本算法挑战
1.翻转字符串算法 1 function reverseString(str) { 2 var res=str.split("").reverse().join(""); 3 return res; 4 } 5 reverseString("hello"); 2.阶乘算法 1 function fa ...
分类:编程语言   时间:2018-11-15 00:08:48    阅读次数:231
#5 Longest Palindromic Substring
这道题主要是有三个变量。因为要确定一个substring,就有start point和end point,这组成了两个变量。然后其次,我们至少对每个substring从头到尾loop一遍,来确定这个substring是不是palindrome,这又需要一个n。所以,如果用暴力解法的话,这道题的tim ...
分类:其他好文   时间:2018-11-12 11:25:52    阅读次数:126
#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
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
2914条   上一页 1 ... 50 51 52 53 54 ... 292 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!