Class Solution
java.lang.Object
g2701_2800.s2719_count_of_integers.Solution
2719 - Count of Integers.<p>Hard</p>
<p>You are given two numeric strings <code>num1</code> and <code>num2</code> and two integers <code>max_sum</code> and <code>min_sum</code>. We denote an integer <code>x</code> to be <em>good</em> if:</p>
<ul>
<li><code>num1 <= x <= num2</code></li>
<li><code>min_sum <= digit_sum(x) <= max_sum</code>.</li>
</ul>
<p>Return <em>the number of good integers</em>. Since the answer may be large, return it modulo <code>10<sup>9</sup> + 7</code>.</p>
<p>Note that <code>digit_sum(x)</code> denotes the sum of the digits of <code>x</code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> num1 = “1”, num2 = “12”, <code>min_sum</code> = 1, max_sum = 8</p>
<p><strong>Output:</strong> 11</p>
<p><strong>Explanation:</strong> There are 11 integers whose sum of digits lies between 1 and 8 are 1,2,3,4,5,6,7,8,10,11, and 12. Thus, we return 11.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> num1 = “1”, num2 = “5”, <code>min_sum</code> = 1, max_sum = 5</p>
<p><strong>Output:</strong> 5</p>
<p><strong>Explanation:</strong> The 5 integers whose sum of digits lies between 1 and 5 are 1,2,3,4, and 5. Thus, we return 5.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= num1 <= num2 <= 10<sup>22</sup></code></li>
<li><code>1 <= min_sum <= max_sum <= 400</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
count
-