Given a sequence A, write a program that computes the length of its longest increasing subsequence.
A subsequence of A is what remains after deleting zero or more elements and keeping the rest in their original order. A subsequence is increasing when every element is strictly smaller than the element right after it. Two elements with the same value cannot sit next to each other in one increasing subsequence.
For example, if A={10,20,10,30,20,50}, the longest increasing subsequence is {10,20,30,50} and its length is 4.