Tap here to switch tabs
Problem
Submissions

Problem: Count Symmetric Integers

med
30 min
Try to solve the Count Symmetric Integers problem.

Statement

You are given two positive integers low and high.

An integer consisting of 2⋅n2 \cdot n digits is defined as symmetric if the sum of its first nn digits is equal to the sum of its last nn digits. Numbers composed of an odd number of digits are never symmetric.

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

Constraints:

  • 1≤1 \leq low ≤\leq high ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Symmetric Integers

med
30 min
Try to solve the Count Symmetric Integers problem.

Statement

You are given two positive integers low and high.

An integer consisting of 2⋅n2 \cdot n digits is defined as symmetric if the sum of its first nn digits is equal to the sum of its last nn digits. Numbers composed of an odd number of digits are never symmetric.

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

Constraints:

  • 1≤1 \leq low ≤\leq high ≤104\leq 10^4