Trains the technique from
LeetCode 246Strobogrammatic NumberThis 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 reading is given as the string num, made only of digits.
Turning the whole reading upside down turns each digit in place and reverses their order. Only some digits survive the turn: 0, 1 and 8 turn into themselves, while 6 and 9 turn into each other. Every other digit becomes unreadable.
Return whether the reading looks exactly the same after being turned upside down.
Example 1
The outer ones turn into each other, and the nine and six in the middle swap into each other, so the turned reading matches the original.
Example 2
The two has no turned form at all, so the reading cannot survive.
Example 3
A single zero turns into itself, so the reading is unchanged.
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 is_strobogrammatic(num: str) -> bool:public boolean isStrobogrammatic(String num)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.