mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
29 lines
690 B
HTML
29 lines
690 B
HTML
<p>给定一个整数 <code>num</code>,计算所有小于等于 <code>num</code> 的非负整数中数字 <code>1</code> 出现的个数。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>num = 0
|
||
<strong>输出:</strong>0
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>num = 13
|
||
<strong>输出:</strong>6</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>0 <= num < 10<sup>9</sup></code></li>
|
||
</ul>
|
||
|
||
<p>注意:本题与主站 233 题相同:<a href="https://leetcode-cn.com/problems/number-of-digit-one/">https://leetcode-cn.com/problems/number-of-digit-one/</a></p>
|
||
|
||
<p> </p>
|