<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 sumOfNumberAndReverse(self, num: int) -> bool:

        numDigits = len(str(num))

        if num <= 18 and num % 2 == 0:
            return True
        if (numDigits == 2 or num <= 198) and num % 11 == 0 :
            return True
        if numDigits == 3 or num <= 1998:
            for a_plus_c in range(1, 19):
                b = (num - 101 * a_plus_c) / 20.0
                if b < 0: break
                if b in range(10):
                    return True
        if numDigits == 4 or num <= 19998:
            for a_plus_d in range(1, 19):
                b_plus_c = (num - 1001 * a_plus_d) / 110.0
                if b_plus_c < 0: break
                if b_plus_c in range(19):
                    return True
        if numDigits == 5 or num <= 199998:
            for a_plus_e in range(1, 19):
                for b_plus_d in range(0, 19):
                    c = (num - 10001 * a_plus_e - 1010 * b_plus_d) / 200
                    if c in range(10):
                        return True
        
        return False
81