The mark that is never removed
transcript
Count tests that failed twice. Sort the questions by right end. Mark each test's second latest place. It looks right. Does it hold?
One test fails in three builds. After build one, mark build zero. After build two, mark build one.
The old mark at build zero stays. Two marks now exist for one test. It counts twice. That is wrong.
A third failure moves the second latest. So the first mark is stale. A stale mark counts twice. Clear it before you mark.
Clear the old second latest mark. Mark the new second latest place. Then count the marks in the range. Now every test counts once.
Test a value that appears exactly twice. Test a value that appears three times. Test a value that appears four times.
A value moves its mark. So clear the old one first. Test a value that appears three times. Then every count is right. Full breakdown in the lecture.