用sliding window的方法,之前还有个k不同元素好像也是类似的思路。有时间可以去复习下。 ...
分类:
其他好文 时间:
2016-10-16 23:43:46
阅读次数:
148
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 ...
分类:
其他好文 时间:
2016-10-16 07:49:39
阅读次数:
197
(1)动态规划,时间复杂度O(N^2),超时 (2)以当前点为中心点,枚举所有可能的回文串,时间复杂度O(N^2),AC ...
分类:
其他好文 时间:
2016-10-16 01:04:00
阅读次数:
112
最长公共子序列问题 核心代码: UVA10405 Longest Common Subsequence 模板题 代码: UVA10252 Common Permutation 求一个最长子序列。使得子序列的全排列中有一个(可以不相同)是2个字符串的子序列. 仔细思考并不是LCS问题,直接模拟有多少个 ...
分类:
其他好文 时间:
2016-10-15 22:39:44
阅读次数:
226
Description Farmer John is trying to figure out when his last shipment of feed arrived. Starting with an empty grain bin, he ordered and received F1 ( ...
分类:
其他好文 时间:
2016-10-14 09:54:30
阅读次数:
199
Given a string, find the length of the longest substring without repeating characters. Have you met this question in a real interview? Yes Given a str ...
分类:
其他好文 时间:
2016-10-14 07:04:04
阅读次数:
170
问题描述: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique ...
分类:
其他好文 时间:
2016-10-14 00:31:17
阅读次数:
185
Description 给出两个字符串,求最长公共子串. Sol SAM. 这题随便做啊...后缀数组/Hash+二分都可以. SAM就是模板啊...直接在SAM上跑就行,没有了 \(go[w]\) 就往 \(par\) 跳. 每走一步统计一下答案. Code ...
分类:
其他好文 时间:
2016-10-12 22:21:56
阅读次数:
137
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 l ...
分类:
其他好文 时间:
2016-10-12 13:30:49
阅读次数:
113