Problem Description
There is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the maximum element and the minimum ...
分类:
其他好文 时间:
2015-05-16 11:57:35
阅读次数:
127
1631 LockerA password locker with N digits, each digit can be rotated to 0-9 circularly.You can rotate 1-3 consecutive digits up or down in one step.F...
分类:
其他好文 时间:
2015-05-16 10:19:13
阅读次数:
725
(1)问题描述:给定n个整数A1,A2,A3...An。按照从左往右的顺序选择尽可能多的整数,组成一个上升子序列,其中相邻元素不能相等。
(2)解题思路:本题就是经典的最长上升子序列问题(Longest Increasing Subsequence,LIS)。可以通过动态规划解决。定义状态d(i)表示以下标i结尾的LIS的最大长度。那么不难得到如下状态转移方程:
d(i)=max{0,d(j)...
分类:
其他好文 时间:
2015-05-16 09:14:04
阅读次数:
100
试题请參见:https://oj.leetcode.com/problems/longest-common-prefix/题目概述Write a function to find the longest common prefix string amongst an array of strings...
分类:
其他好文 时间:
2015-05-15 15:13:04
阅读次数:
104
Longest Ordered SubsequenceTime Limit:2000MSMemory Limit:65536KTotal Submissions:32192Accepted:14093DescriptionA numeric sequence ofaiis ordered ifa1i...
分类:
其他好文 时间:
2015-05-15 10:35:45
阅读次数:
128
Write a function to find the longest common prefix string amongst an array of strings.
分类:
其他好文 时间:
2015-05-14 20:14:06
阅读次数:
99
Problem:
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substri...
分类:
编程语言 时间:
2015-05-14 18:44:41
阅读次数:
121
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 leaf node.
分析;
此题是求二叉树的深度,(无所谓最大深度),用递归的方法很容...
分类:
其他好文 时间:
2015-05-14 14:18:49
阅读次数:
117
题目:
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 ...
分类:
其他好文 时间:
2015-05-13 19:51:47
阅读次数:
145
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 leaf node./**
* Definition for binary tree
* stru...
分类:
其他好文 时间:
2015-05-13 19:42:48
阅读次数:
143