{"id":"visit-before-enqueue-prevents-duplicates","text":"In `matrix-cells-in-distance-order/solution.py`, marking cells as visited at enqueue time (not dequeue time) ensures each cell enters the queue at most once, preventing duplicate work and incorrect output.","truth_value":"IN","source":"entries/2026/06/06/matrix-cells-in-distance-order-solution.md","source_url":"","source_hash":"","justifications":[],"dependents":[],"metadata":{},"created_at":"","updated_at":"","reviewed_at":"","verified_at":"","retracted_at":"","explanation":{"steps":[{"node":"visit-before-enqueue-prevents-duplicates","truth_value":"IN","reason":"premise"}]}}