ROSALIND | Longest Increasing Subsequence (LGIS)
給一正整數列,求其最長的遞增與遞減子數列。例如數列 5, 1, 4, 2, 3 的最長遞增數列為 1, 2, 3,最長遞減數列則為 5, 4, 3。
Given: A positive integer n≤10000 followed by a permutation π of length n.
Return: A longest increasing subsequence of π , followed by a longest decreasing subsequence of π.