Posted By

rishi_devan on 08/20/15


Tagged


Versions (?)

Maximum Sum Increasing Subsequence


 / Published in: Python
 

Dynamic Programming

  1. arr = [1,101,2,3,100,4,5]
  2. msis = [elem for elem in arr]
  3.  
  4. for x in range(1,len(arr),1):
  5. for y in range(0,x,1):
  6. if arr[x] > arr[y]:
  7. msis[x] += arr[y]
  8.  
  9. print(max(msis))

Report this snippet  

You need to login to post a comment.