Skip to content
Code ReadingLargest Run Total
Break the Code

Largest Run Total

Write a list for which this function gives the wrong answer.
1def best_run(values):
2 best = 0
3 current = 0
4 for v in values:
5 current = max(0, current + v)
6 best = max(best, current)
7 return best