fork download
  1. a = [-2, -3, 4, -1, -2, 1, 5, -3]
  2. mth = 0
  3. maxi = 0
  4. for i in a:
  5. mth = mth + i
  6. if(mth < 0):
  7. mth = 0
  8. elif(mth > maxi):
  9. maxi = mth
  10. print(maxi)
  11.  
Success #stdin #stdout 0.09s 10104KB
stdin
Standard input is empty
stdout
7