<p>You are given two positive integers <code>low</code> and <code>high</code>.</p>

<p>An integer <code>x</code> consisting of <code>2 * n</code> digits is <strong>symmetric</strong> if the sum of the first <code>n</code> digits of <code>x</code> is equal to the sum of the last <code>n</code> digits of <code>x</code>. Numbers with an odd number of digits are never symmetric.</p>

<p>Return <em>the <strong>number of symmetric</strong> integers in the range</em> <code>[low, high]</code>.</p>

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

<pre>
<strong>Input:</strong> low = 1, high = 100
<strong>Output:</strong> 9
<strong>Explanation:</strong> There are 9 symmetric integers between 1 and 100: 11, 22, 33, 44, 55, 66, 77, 88, and 99.
</pre>

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

<pre>
<strong>Input:</strong> low = 1200, high = 1230
<strong>Output:</strong> 4
<strong>Explanation:</strong> There are 4 symmetric integers between 1200 and 1230: 1203, 1212, 1221, and 1230.
</pre>

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

<ul>
	<li><code>1 &lt;= low &lt;= high &lt;= 10<sup>4</sup></code></li>
</ul>

class Solution:
    def countSymmetricIntegers(self, low: int, high: int) -> int:
        ans = 0
        if low < 100:
            ans = min(high,99)//11 - (low-1)//11

        if high < 1_000:
            return ans

        sums = {
            0:  (0,),
            1:  (1, 10),
            2:  (2, 11, 20),
            3:  (3, 12, 21, 30),
            4:  (4, 13, 22, 31, 40),
            5:  (5, 14, 23, 32, 41, 50),
            6:  (6, 15, 24, 33, 42, 51, 60),
            7:  (7, 16, 25, 34, 43, 52, 61, 70),
            8:  (8, 17, 26, 35, 44, 53, 62, 71, 80),
            9:  (9, 18, 27, 36, 45, 54, 63, 72, 81, 90),
            10: (19, 28, 37, 46, 55, 64, 73, 82, 91),
            11: (29, 38, 47, 56, 65, 74, 83, 92),
            12: (39, 48, 57, 66, 75, 84, 93),
            13: (49, 58, 67, 76, 85, 94),
            14: (59, 68, 77, 86, 95),
            15: (69, 78, 87, 96),
            16: (79, 88, 97),
            17: (89, 98),
            18: (99,)}

        m = max(low//100, 10)
        n = high//100
        for i in range(m, n+1):
            x,y = divmod(i,10)
            i*=100

            for s in sums[x+y]:
                num = i+s
                if num < low:
                    continue

                if num > high:
                    break

                ans += 1

        return ans
45