Skip to content

Instantly share code, notes, and snippets.

@inspirit941
Created December 18, 2019 06:28
Show Gist options
  • Save inspirit941/426ae62e7f2da7460f957855f27c8812 to your computer and use it in GitHub Desktop.
Save inspirit941/426ae62e7f2da7460f957855f27c8812 to your computer and use it in GitHub Desktop.
import sys
N = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
result = [1] * N
for i in range(1, N):
for j in range(i):
if arr[j] < arr[i]:
result[i] = max(result[i], result[j]+1)
print(max(result))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment