1. longest-consecutive-sequence Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given[1 ...
分类:
编程语言 时间:
2016-04-06 14:44:43
阅读次数:
178
题目: 解题思路:1、简单思路:暴力破解法,时间复杂度O(n^3),肯定通不过。 2、动态规划法:(一般含“最XX”等优化词义的题意味着都可以动态规划求解),时间复杂度O(n^2),空间复杂度O(n^2)。 形如"abba", "abbba"这样的字符串,如果用dp[i][j]表示从下标i到j之间的 ...
分类:
其他好文 时间:
2016-04-06 11:03:39
阅读次数:
202
水题。枚举中间,暴力算最远的。也可以用(Manacher) ...
分类:
其他好文 时间:
2016-04-06 09:24:33
阅读次数:
143
原问题描述如下。 Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given [100, 4, 200, 1, 3, 2], ...
分类:
其他好文 时间:
2016-04-05 22:38:53
阅读次数:
246
补充:zip迭代器和zip_longest迭代器 python3中的zip是可迭代的对象,可以节省内存空间 zip(*iterables) #构造函数 zip拼接多个可迭代对象iter1,iter2...的元素,返回新的可迭代对象,其元素为各系列iter1,iter2...对象元素组成的元组。如果各 ...
分类:
编程语言 时间:
2016-04-05 16:21:38
阅读次数:
219
Write a SQL query to find all numbers that appear at least three times consecutively. For example, given the above Logs table, 1 is the only number th ...
分类:
其他好文 时间:
2016-04-05 12:32:25
阅读次数:
137
文章目录如下 (1)自己的思路 (2)自己的代码 (3)别人的思路 (4)别人的代码 (5)对比自己的不足之处 题目如下: Write a function to find the longest common prefix string amongst an array of strings. ( ...
分类:
其他好文 时间:
2016-04-05 02:00:44
阅读次数:
117
Given a string, find the length of the longest substring T that contains at most k distinct characters. For example, Given s = “eceba” and k = 2, T is ...
分类:
其他好文 时间:
2016-04-04 09:11:32
阅读次数:
290
A simple variation to "Longest Substring with At Most Two Distinct Characters". A typical sliding window problem. ...
分类:
其他好文 时间:
2016-04-04 06:44:56
阅读次数:
123