fork download
  1. n = 5
  2. a = [1,4,3,5,2]
  3. f = [0] * n
  4. f[0] = 1
  5. for i in range(1,n):
  6. print(f)
  7. m = 0
  8. for j in range(i):
  9. if a[j] < a[i]:
  10. if f[j] > m:
  11. m = f[j]
  12. f[i] = m + 1
  13. print(max(f))
Success #stdin #stdout 0.03s 9636KB
stdin
45
stdout
[1, 0, 0, 0, 0]
[1, 2, 0, 0, 0]
[1, 2, 2, 0, 0]
[1, 2, 2, 3, 0]
3