[LintCode] Longest Increasing Continuous Subsequence 最长连续递增子序列
Posted Grandyang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LintCode] Longest Increasing Continuous Subsequence 最长连续递增子序列相关的知识,希望对你有一定的参考价值。
Give an integer array,find the longest increasing continuous subsequence in this array.
An increasing continuous subsequence:
- Can be from right to left or from left to right.
- Indices of the integers in the subsequence should be continuous.
Notice
O(n) time and O(1) extra space.
Example
For [5, 4, 2, 1, 3]
, the LICS is [5, 4, 2, 1]
, return 4
.
For [5, 1, 2, 3, 4]
, the LICS is [1, 2, 3, 4]
, return 4
.
以上是关于[LintCode] Longest Increasing Continuous Subsequence 最长连续递增子序列的主要内容,如果未能解决你的问题,请参考以下文章
lintcode-medium-Longest Increasing Subsequence
lintcode-medium-Longest Consecutive Sequence
[Lintcode]124. Longest Consecutive Sequence/[Leetcode]128. Longest Consecutive Sequence