Five billion runs, or one pass.
transcript
One way to find the best run. Add every run. Keep the largest. It is correct. Now count the work. One nanosecond a step. A dashboard refresh has one second.
Eight days have thirty six runs. That is instant. Twice the days is four times the runs. The count grows like n squared. Ten days make fifty five runs. A thousand days make about five hundred thousand.
The store has a hundred thousand days. That is five billion and fifty thousand runs. At a nanosecond each, that is five seconds. The dashboard has one second. Same days, added again and again. That repeated work is the cost.
The pass visits each value once. That is a hundred thousand steps. Fifty thousand times fewer. Two numbers are all it keeps. Count the work before you code. It never stores a run. Memory stays constant.
Count before you code. Full breakdown in the lecture.