Problem 2598 · Medium

Smallest Missing Non-negative Integer After Operations

Count each number by its remainder modulo value, then build 0, 1, 2, and so on, spending one count from the matching remainder each time.

Open the interactive visualisation