Leetcode 2598. Smallest Missing Non-negative Integer After Operations
Because adding/subtracting value preserves each element's remainder modulo value, each number can become any integer in its congruence class; the task is to maximize the MEX by using counts of residues to cover consecutive nonnegative integers starting from 0, greedily consuming one available element from residue i % value for each i until a residue is exhausted.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.