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 longest ...
分类:
其他好文 时间:
2014-12-02 13:22:25
阅读次数:
140
动态规划Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longes...
分类:
其他好文 时间:
2014-12-01 20:48:25
阅读次数:
250
任务是判断可能出现的情况:1.空格2.空指针3.首字符是04.首字符是“+”或“-”5.判断边界条件,上界INT_MAX=2147483647,下届INT_MIN=-2147483648,小心判断 1 // 2 // main.cpp 3 // Longest Substring 4 // ...
分类:
其他好文 时间:
2014-11-30 14:07:58
阅读次数:
163
最长上升子序列(Longest Increasing Subsquence)是指对一个序列,其中满足i
LIS普遍求法为动态规划。有两种算法。
第一种比较好写,复杂度O(n^2)。
设原序列为a[]。所有下标从1开始(即[1,n])。定义dp[i]为以a[i]结尾的最长上升子序列的长度。很容易得到转移方程:dp[i] = max{1, dp[j] + 1} 且 j
dp[i] = 1;...
分类:
编程语言 时间:
2014-11-30 12:37:30
阅读次数:
198
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2014-11-30 07:04:09
阅读次数:
163
Write a function to find the longest common prefix string amongst an array of strings.Solution: 1 public class Solution { 2 public String longestC...
分类:
其他好文 时间:
2014-11-29 11:35:58
阅读次数:
165
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 le...
分类:
其他好文 时间:
2014-11-29 06:50:19
阅读次数:
189
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2014-11-28 06:10:44
阅读次数:
172
题目:
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substrin...
分类:
其他好文 时间:
2014-11-27 23:42:23
阅读次数:
196
问题描述:
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 ...
分类:
其他好文 时间:
2014-11-27 20:32:31
阅读次数:
135