def compute_sub_max(num_list): result_list = [1] for i, one_num in enumerate(num_list[1:]): # 找到以第i个位置结尾的最长子串长度 i += 1 max_len = 1 while i >= 0: if num_list[i] < one_num: max_len = max(max_len, result_list[i] + 1) i -= 1 result_list.append(max_len) return max(result_list)