<p>Given a <strong>non-negative</strong> integer <code>num</code>, return <code>true</code><em> if </em><code>num</code><em> can be expressed as the sum of any <strong>non-negative</strong> integer and its reverse, or </em><code>false</code><em> otherwise.</em></p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> num = 443
<strong>Output:</strong> true
<strong>Explanation:</strong> 172 + 271 = 443 so we return true.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> num = 63
<strong>Output:</strong> false
<strong>Explanation:</strong> 63 cannot be expressed as the sum of a non-negative integer and its reverse so we return false.
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> num = 181
<strong>Output:</strong> true
<strong>Explanation:</strong> 140 + 041 = 181 so we return true. Note that when a number is reversed, there may be leading zeros.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>0 &lt;= num &lt;= 10<sup>5</sup></code></li>
</ul>

class Solution:
    def is_anagram(self, n1, n2):
        s1 = list(str(n1))
        s2 = list(str(n2))

        shorter = s1
        longer = s2
        if len(s1) < len(s2):
            longer = s2
            shorter = s1
        elif len(s1) > len(s2):
            longer = s1
            shorter = s2

        lendiff = len(longer) - len(shorter)
        shorter = (["0"] * lendiff) + shorter

        # print(f'longer={longer}, shorter={shorter}')
        for i in range(len(shorter)):
            if shorter[i] != longer[-(i+1)]:
                return False

        return True

    def sumOfNumberAndReverse(self, num: int) -> bool:
        if num == 0:
            return True

        for i in range((num//2) + 1):
            is_anagram = self.is_anagram(i, num-i)
            if is_anagram:
                return True

        return False
2666