Mid/SeniorEnumerationMath

Sum of Number and Its Reverse

Given a non-negative integer num, return true if num can be expressed as the sum of any non-negative integer and its reverse, or false otherwise.

When a number is reversed, it may have leading zeros.

Example 1
Inputnum = 443
Outputtrue
172 + 271 = 443, so the number can be expressed as a non-negative integer plus its reverse.
Example 2
Inputnum = 63
Outputfalse
63 cannot be expressed as the sum of a non-negative integer and its reverse.

Constraints

  • 0 <= num <= 10^5

Asked at 1 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate