题目: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 farthes....
分类:
编程语言 时间:
2014-07-31 02:41:15
阅读次数:
229
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 longes...
分类:
其他好文 时间:
2014-07-31 02:19:45
阅读次数:
243
两个都是最长上升子序列,所以就放一起了1631 因为长度为40000,所以要用O(nlogn)的算法,其实就是另用一个数组c来存储当前最长子序列每一位的最小值,然后二分查找当前值在其中的位置;如果当前点不能作为当前最长子序列的最大值,则更新找到值为两者间的较小值。2533 就是一个裸的最长上升子序列...
分类:
其他好文 时间:
2014-07-30 20:13:04
阅读次数:
230
// Longest Nap (最长打盹时间)
// PC/UVa IDs: 110404/10191, Popularity: B, Success rate: average Level: 1
// Verdict: Accepted
// Submission Date: 2014-07-28
// UVa Run Time: 0.018s
//
// 版权所有(C)2014,邱秋。meta...
分类:
其他好文 时间:
2014-07-29 14:57:08
阅读次数:
223
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring
without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo...
分类:
其他好文 时间:
2014-07-29 14:28:48
阅读次数:
218
这两天去学了一下,觉得下面那篇文章写的很好,有例子,比较容易懂,所以转一下。以下内容来自:hihoCoder:小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。这一天,他们遇到了一连串的字符串,于是小Hi就向小Ho提出了那个经典...
分类:
其他好文 时间:
2014-07-29 12:41:26
阅读次数:
292
1 public class Solution { 2 public static int lengthOfLongestSubstring(String s) { 3 4 char[] arr = s.toCharArray(); 5 int pre = 0; 6 ...
Similar with "Longest Consecutive Sequence". Another usage to hashset.Take care of corner cases!class Solution {public: int firstMissingPositive(in...
分类:
其他好文 时间:
2014-07-28 15:16:43
阅读次数:
206
题目:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letter....
分类:
编程语言 时间:
2014-07-28 11:34:30
阅读次数:
265
题目:Write a function to find the longest common prefix string amongst an array of strings.题解:解题思路是,先对整个String数组预处理一下,求一个最小长度(最长前缀肯定不能大于最小长度)。然后以第0个字符串....
分类:
编程语言 时间:
2014-07-28 11:33:30
阅读次数:
241