Trains the technique from
LeetCode 206Reverse Linked ListThis 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 probe stores its telemetry as a one-way chain of frames: every frame carries a signed reading and a link to the frame recorded after it, and the final frame links to nothing.
Because the harness passes plain JSON, the chain reaches you as the array frames, holding the readings in order from the front frame to the last one. An empty array means the chain has no frames at all. Your answer must use the same shape: the readings of the rebuilt chain, front frame first.
Turn the chain around so the frame that was last becomes the front and every link points at the frame that used to precede it. Solve it the way the chain itself demands: rebuild the frames, then walk them once and redirect one link at a time, carrying the frame behind you as you go. Beyond the frames themselves and the array you return, only a fixed number of frame references may be held.
Example 1
The frame holding -12 was last, so it becomes the front, and the readings come back in the opposite order. Repeated readings keep both copies.
Example 2
With two frames the single link between them flips, so the second frame leads.
Example 3
A lone frame has no link to redirect, so the chain comes back unchanged. A chain of zero frames likewise answers with an empty chain.
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 rewind_telemetry_chain(frames: list[int]) -> list[int]:public int[] rewindTelemetryChain(int[] frames)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.