Trains the technique from
LeetCode 344Reverse StringThis 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.
An engraving machine loaded a strip of stamps back to front. The strip is given as strip, a list whose entries are single-character strings, one printable ASCII character per stamp, listed from the front of the strip to the back.
Re-seat the stamps so the strip reads back to front: the stamp at the back moves to the front slot, the one before it moves to the second slot, and so on.
The machine has no spare tray, so you may not build a second list of stamps. Rearrange the entries inside strip itself, using only a constant amount of extra space on top of the input, then return that same list so the result can be inspected.
Example 1
The five stamps end up in the opposite order, and the middle one never moves.
Example 2
Spaces, digits and punctuation are ordinary stamps and are re-seated like any letter.
Example 3
A one-stamp strip already reads the same in both directions, so nothing moves.
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 flip_strip(strip: list[str]) -> list[str]:public char[] flipStrip(char[] strip)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.