아래와 같이 풀었을 때, 마지막 줄 max(count) 쓰면 정답이고 count[-1] 쓰면 틀립니다. 이유가 뭘까요
import sys
n = int(sys.stdin.readline())
lst = [int(x) for x in sys.stdin.readline().split()]
count = [1 for x in range(n)]
for i in range(1, n):
for j in range(i):
if lst[i] < lst[j]:
count[i] = max(count[i], count[j]+1)
print(n - max(count))
junyub2 2년 전 1
아래와 같이 풀었을 때, 마지막 줄 max(count) 쓰면 정답이고 count[-1] 쓰면 틀립니다. 이유가 뭘까요