Algorithms
Easy
2843
2998
  Count Symmetric Integers
count-symmetric-integers
"""
You are given two positive integers low and high.

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

Return the number of symmetric integers in the range [low, high].

Example 1:

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

Example 2:

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


Constraints:

 * 1 <= low <= high <= 104
"""
class Solution:
    def countSymmetricIntegers(self, low: int, high: int) -> int:
        
You are given two positive integers low and high.

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

Return the number of symmetric integers in the range [low, high].

Example 1:

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

Example 2:

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


Constraints:

 * 1 <= low <= high <= 104


Please complete the code below to solve above prblem:
```python
class Solution:
    def countSymmetricIntegers(self, low: int, high: int) -> int:
        
```

my_solution = Solution()

test_input = { "low": 1, "high": 100 }
assert my_solution.countSymmetricIntegers(**test_input) == 9

test_input = { "low": 1200, "high": 1230 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 1 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 1, "high": 2 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 1, "high": 3 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 1, "high": 4 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 1, "high": 5 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 1, "high": 6 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 1, "high": 7 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 1, "high": 8 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 1, "high": 9 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 1, "high": 10 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 1, "high": 11 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 12 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 13 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 14 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 15 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 16 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 17 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 18 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 19 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 20 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 21 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 1, "high": 22 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 23 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 24 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 25 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 26 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 27 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 28 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 29 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 30 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 31 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 32 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 1, "high": 33 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 34 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 35 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 36 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 37 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 38 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 39 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 40 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 41 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 42 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 43 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 1, "high": 44 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 45 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 46 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 47 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 48 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 100, "high": 1782 }
assert my_solution.countSymmetricIntegers(**test_input) == 44

test_input = { "low": 1, "high": 49 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 50 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 51 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 52 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 53 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 54 }
assert my_solution.countSymmetricIntegers(**test_input) == 4

test_input = { "low": 1, "high": 55 }
assert my_solution.countSymmetricIntegers(**test_input) == 5

test_input = { "low": 1, "high": 56 }
assert my_solution.countSymmetricIntegers(**test_input) == 5

test_input = { "low": 1, "high": 57 }
assert my_solution.countSymmetricIntegers(**test_input) == 5

test_input = { "low": 1, "high": 58 }
assert my_solution.countSymmetricIntegers(**test_input) == 5

test_input = { "low": 1, "high": 59 }
assert my_solution.countSymmetricIntegers(**test_input) == 5

test_input = { "low": 1, "high": 60 }
assert my_solution.countSymmetricIntegers(**test_input) == 5

test_input = { "low": 2, "high": 2 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 2, "high": 3 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 2, "high": 4 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 2, "high": 5 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 2, "high": 6 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 2, "high": 7 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 2, "high": 8 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 2, "high": 9 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 2, "high": 10 }
assert my_solution.countSymmetricIntegers(**test_input) == 0

test_input = { "low": 2, "high": 11 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 12 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 13 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 14 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 15 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 16 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 17 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 18 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 19 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 20 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 21 }
assert my_solution.countSymmetricIntegers(**test_input) == 1

test_input = { "low": 2, "high": 22 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 23 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 24 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 25 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 26 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 27 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 28 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 29 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 30 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 31 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 32 }
assert my_solution.countSymmetricIntegers(**test_input) == 2

test_input = { "low": 2, "high": 33 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 2, "high": 34 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 2, "high": 35 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 2, "high": 36 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 2, "high": 37 }
assert my_solution.countSymmetricIntegers(**test_input) == 3

test_input = { "low": 2, "high": 38 }
assert my_solution.countSymmetricIntegers(**test_input) == 3