第41292题 单选题
下面代码可以用来求最长上升子序列(LIS)的长度,如果输入是整数序列是:5 1 7 3 5 9,则输出是( )。
arr = list(map(int,input().split(",")))
cnt = 1
ans = 0

for i in range(len(arr)-1):
    if arr[i] < arr[i+1]:
        cnt += 1
    else:
        ans = max(ans,cnt)
        cnt = 1
    ans = max(ans,cnt)
    print(ans)
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
知识点:
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析