2022-03-27 18:27:43 +08:00
|
|
|
<p>You are given an integer <code>n</code>.</p>
|
|
|
|
|
|
|
|
<p>Each number from <code>1</code> to <code>n</code> is grouped according to the sum of its digits.</p>
|
|
|
|
|
|
|
|
<p>Return <em>the number of groups that have the largest size</em>.</p>
|
|
|
|
|
|
|
|
<p> </p>
|
2023-12-09 18:42:21 +08:00
|
|
|
<p><strong class="example">Example 1:</strong></p>
|
2022-03-27 18:27:43 +08:00
|
|
|
|
|
|
|
<pre>
|
|
|
|
<strong>Input:</strong> n = 13
|
|
|
|
<strong>Output:</strong> 4
|
|
|
|
<strong>Explanation:</strong> There are 9 groups in total, they are grouped according sum of its digits of numbers from 1 to 13:
|
|
|
|
[1,10], [2,11], [3,12], [4,13], [5], [6], [7], [8], [9].
|
|
|
|
There are 4 groups with largest size.
|
|
|
|
</pre>
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
<p><strong class="example">Example 2:</strong></p>
|
2022-03-27 18:27:43 +08:00
|
|
|
|
|
|
|
<pre>
|
|
|
|
<strong>Input:</strong> n = 2
|
|
|
|
<strong>Output:</strong> 2
|
|
|
|
<strong>Explanation:</strong> There are 2 groups [1], [2] of size 1.
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li><code>1 <= n <= 10<sup>4</sup></code></li>
|
|
|
|
</ul>
|