Python 超时
class Solution: def LIS(self, arr): # write code here length = len(arr) if len(arr) < 1: return [] dp = [[a] for a in arr] ans = [] for i in range(length): for j in range(i): if arr[i] > arr[j]: if len(dp[j]) + 1 >= len(dp[i]): dp[i] = dp[j] + [arr[i]] res = dp[0] print(dp) for i in range(1, length): if len(dp[i]) > len(res): res = dp[i] return res