def longest_increasing_subsequence(sequence):
length = len(sequence)<EOL>counts = [<NUM_LIT:1> for _ in range(length)]<EOL>for i in range(<NUM_LIT:1>, length):<EOL><INDENT>for j in range(<NUM_LIT:0>, i):<EOL><INDENT>if sequence[i] > sequence[j]:<EOL><INDENT>counts[i] = max(counts[i], counts[j] + <NUM_LIT:1>)<EOL>print(counts)<EOL><DEDENT><DEDENT><DEDENT>return max(counts)<EOL>
Dynamic Programming Algorithm for
counting the length of longest increasing subsequence
type sequence: List[int]