1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-12 17:05:15 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/统计最大组的数目 [count-largest-group].html
2025-09-29 14:43:44 +08:00

33 lines
1012 B
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定一个整数 <code>n</code>&nbsp;</p>
<p>我们需要根据数字的数位和将 <code>1</code><code>n</code> 的数字分组。例如,数字 14 和 5 属于 <strong>同一</strong>&nbsp;组,而数字 13 和 3 属于 <strong>不同</strong>&nbsp;组。</p>
<p>返回最大组的数字数量,即元素数量 <strong>最多</strong> 的组。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>n = 13
<strong>输出:</strong>4
<strong>解释:</strong>总共有 9 个组,将 1 到 13 按数位求和后这些组分别是:
[1,10][2,11][3,12][4,13][5][6][7][8][9]。总共有 4 个组拥有的数字并列最多。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>n = 2
<strong>输出:</strong>2
<strong>解释:</strong>总共有 2 个大小为 1 的组 [1][2]。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 10<sup>4</sup></code></li>
</ul>