Pick the fix
Lockers in a ring hold [3, 1, 3]. The row version returns 6. What is wrong?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A It opens the first and last lockers, which are neighbours in a ring
Right: the true answer is 3.
Dropping one end per run removes exactly the forbidden pair and nothing else.
Why not the others?
- B Nothing; 6 is correct. Lockers 0 and 2 touch in a ring.
- C It should return 7, the total. Opening all three breaks the rule twice.