Sum of Number and Its Reverse - Problem
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.
The reverse of an integer is obtained by reversing the order of its digits. For example, the reverse of 123 is 321.
Example: If num = 443, we can express it as 181 + 181 (where 181 reversed is 181), so return true.
Input & Output
Example 1 — Palindromic Sum
$
Input:
num = 443
›
Output:
true
💡 Note:
443 can be expressed as 370 + 73, where 73 is the reverse of 370.
Example 2 — Simple Case
$
Input:
num = 63
›
Output:
true
💡 Note:
63 can be expressed as some number plus its reverse. For example, we need to find x where x + reverse(x) = 63.
Example 3 — Impossible Case
$
Input:
num = 4
›
Output:
true
💡 Note:
4 can be expressed as 2 + 2, where the reverse of 2 is 2.
Constraints
- 0 ≤ num ≤ 106
Visualization
Tap to expand
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code