Trains the technique from
LeetCode 9Palindrome 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 two-way flow meter shows one signed whole number, reading. Flow drawn off the main drives the counter up and flow pushed back into the main drives it down, so the display can sit below zero.
The control room marks a reading as mirrored when its digits run the same way in both directions: sweeping the display from the left gives the same digit sequence as sweeping it from the right. The minus sign is printed only at the leading edge of the display and never at the trailing edge, so anything below zero cannot be mirrored. A reading of one digit, zero included, is mirrored.
Return true for a mirrored reading, false for anything else.
The meter firmware ships without any text handling, so your routine has to work on the number arithmetically. Converting the reading into characters and inspecting them is not available to you.
Example 1
Sweeping left to right gives 4, 8, 8, 4 and sweeping the other way gives the same sequence.
Example 2
The digits alone would match, but the minus sign sits only at the leading edge, so the display cannot read alike in both directions.
Example 3
From the right the digits run 0, 5, 2, which is not the sequence 2, 5, 0.
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_mirrored(reading: int) -> bool:public boolean isMirrored(int reading)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.