Longest Increasing Subsequence in Python