fork download
  1. a = [5, 5, 10, 40, 50, 35]
  2. inc = 0
  3. exc = 0
  4. for i in a:
  5. t = exc + i
  6. exc = max(inc,exc)
  7. inc = t
  8. print(max(inc,exc))
  9.  
  10.  
Success #stdin #stdout 0.09s 10104KB
stdin
Standard input is empty
stdout
80