Trains the technique from
LeetCode 137Single Number IIThis 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 calibration bench mirrors every drift reading it takes into three separate journals, so the merged dump carries three copies of each reading the bench produced. One reading was keyed in by hand before mirroring was switched on, and that reading sits in the dump on its own.
The merged dump arrives as the integer array readings. Return the reading that occurs only once. Drift may run either side of zero, so a reading can be negative.
Work in time proportional to the length of readings, and hold only a fixed number of extra values while you do it.
Example 1
Counting copies: 4 appears three times, 7 appears three times and 12 appears three times, while 9 appears once.
Example 2
The dump holds three copies of 8 and a single -5, and the hand-keyed reading is the negative one.
Example 3
The dump carries three copies of 10 and three copies of 1, and -6 is the reading with a single copy.
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 once_logged_reading(readings: list[int]) -> int:public int onceLoggedReading(int[] readings)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.