A run of one
transcript
A driver earns bonuses and penalties. You look for a settled run of two or more trips. A single trip must not count. The code can miss that. Here is the slip.
The remainder is zero, which was seeded. But the gap is one, so the run is one trip. Ask for a gap of at least two.
The key is the remainder of the running total. The value is the first index with that key. Never overwrite the first index.
Minus one modulo six is minus one in Java. It is five in Python. Same class, two values. Add k and take the modulo again.
Test k equal to one. Every run is a multiple. Test a list of zeros. Any two make a run. Test a gap of exactly two. It must count.
Test one trip that is equal to k. Test two trips whose total is k. Test a negative amount.
Seen is not enough. Check the gap is at least two. Keep the first index. Full breakdown in the lecture.