The A Number After a Double Reversal coding problem is a logic-based math challenge. You are given an integer. You reverse it to get reversed1, then you reverse reversed1 to get reversed2. You need to determine if reversed2 is equal to the original number. For example, reversing 123 gives 321, and reversing that gives 123 (Match!). However, reversing 120 gives 21, and reversing that gives 12 (No match!).
While this is an Easy question, companies like Meta and Bloomberg use it to test for edge-case awareness and "out-of-the-box" thinking. A candidate could write a full reversal function, but an efficient candidate will realize there is a much simpler mathematical property at play.
This falls under the Math interview pattern. The core insight is that a double reversal only fails if the number has trailing zeros (unless the number itself is 0). Trailing zeros are lost during the first reversal because leading zeros are not preserved in integers.
num = 526**. No trailing zeros. Reversing once gives 625. Reversing again gives 526. True.num = 1800**. Reversing once gives 81 (the zeros disappear). Reversing again gives 18. 18 != 1800. False.num = 0**. Reversing 0 gives 0, and again gives 0. True.0 itself actually passes the test.Always look for the "trick" in Easy math problems. If a problem seems like it requires a lot of manual steps (like reversing a number twice), there is often a property of numbers (like the parity, sign, or trailing zeros) that lets you answer the question in time.