Trains the technique from
LeetCode 2598Smallest Missing Non-negative Integer After OperationsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A rack holds the readings readings. Each reading may be raised or lowered by step, as often as you like and each independently of the others.
Once the changes are made, return the smallest whole number from 0 upwards that is not among the readings.
Example 1
Each reading leaves a different remainder against four, so 0 through 3 can all be reached, and reaching 4 would need a second reading leaving no remainder.
Example 2
The single reading leaves a remainder of two against five, so it can never be brought to 0.
Example 3
Two readings leave no remainder and two leave one, so 0, 1, 2 and 3 are all reachable and 4 would need a third even reading.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def find_smallest_integer(readings: list[int], step: int) -> int:public int findSmallestInteger(int[] readings, int step)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.