Tap here to switch tabs
Problem
Submissions

Problem: Number of Balanced Integers in a Range

Try to solve the Number of Balanced Integers in a Range problem.

Statement

Given two integers low and high, return the number of balanced integers in the inclusive range from low to high.

An integer is defined as balanced if the sum of its digits at odd positions is equal to the sum of its digits at even positions, where digit positions are numbered starting from 11 from left to right.

Constraints:

  • 1≤1 \leq low ≤\leq high ≤1015\leq 10^{15}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Balanced Integers in a Range

Try to solve the Number of Balanced Integers in a Range problem.

Statement

Given two integers low and high, return the number of balanced integers in the inclusive range from low to high.

An integer is defined as balanced if the sum of its digits at odd positions is equal to the sum of its digits at even positions, where digit positions are numbered starting from 11 from left to right.

Constraints:

  • 1≤1 \leq low ≤\leq high ≤1015\leq 10^{15}