fork download
  1. # your code goes here
  2. #0JLQsNGB0LjQu9C10L3QutC+INCQ0YDRgtC10Lwg
  3. def func(list):
  4. rob1, rob2 = 0, 0
  5. for n in list:
  6. n = int(n)
  7. temp = max(rob1 + n, rob2)
  8. rob1 = rob2
  9. rob2 = temp
  10. print(rob2)
  11. return rob2
  12.  
  13.  
  14. func([1,3,2,5,4,7,6,9,8,10])
  15. func([2,1,4,3,6,5,7,8,10,9])
Success #stdin #stdout 0.09s 14168KB
stdin
Standard input is empty
stdout
34
29