Skip to content

Practice Count Symmetric Integers

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2843
LeetCode Problem

Count Symmetric Integers

Problem Statement

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].

Source: Count Symmetric Integers on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
low = 1, high = 100
Output
9

# Example 2

Input
low = 1200, high = 1230
Output
4

Constraints

1 <= low <= high <= 10^4

Related LeetCode Problems

Practice more problems similar to Count Symmetric Integers.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.