Tap here to switch tabs
Problem
Submissions

Problem: Count of Integers

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

Statement

You are given two numeric strings num1 and num2, and two integers min_sum and max_sum.

Return the number of integers xx such that num1 ≤x≤\leq x \leq num2, and the sum of the digits of xx satisfies min_sum ≤extdigitsum(x)≤\leq ext{digit\\_sum}(x) \leq max_sum. Since the answer may be large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq num1 ≤\leq num2 ≤1022\leq 10^{22}

  • 1≤1 \leq min_sum ≤\leq max_sum ≤400\leq 400

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count of Integers

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

Statement

You are given two numeric strings num1 and num2, and two integers min_sum and max_sum.

Return the number of integers xx such that num1 ≤x≤\leq x \leq num2, and the sum of the digits of xx satisfies min_sum ≤extdigitsum(x)≤\leq ext{digit\\_sum}(x) \leq max_sum. Since the answer may be large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq num1 ≤\leq num2 ≤1022\leq 10^{22}

  • 1≤1 \leq min_sum ≤\leq max_sum ≤400\leq 400