Monotonic incrementing subsequence (2)

Source: Internet
Author: User

Monotonic incrementing subsequence (2)
Monotonic incrementing subsequence (ii) Time Limit: 1000 MS | memory limit: 65535 KB difficulty: 4

Description

Given an integer series {a1, a2..., an} (0

For example, the longest monotonic increasing subsequence of 1 9 10 5 11 2 13 is 1 9 10 11 13 with a length of 5.

Input
Multiple groups of test data (<= 7)
The first row of each group of test data is an integer n, indicating a total of n integers in the sequence, followed by n integers in the next row, indicating all elements in the series. separate each integer with spaces (0 Data ends with EOF.
The input data must be valid (all are int integers )!
Output
For each group of test data, the length of the output integer sequence is the longest incrementing sub-sequence. Each output occupies one row.
Sample Input
71 9 10 5 11 2 1322-1
Sample output
51
 
   
 
    

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.