1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/数字 1 的个数 [1nzheng-shu-zhong-1chu-xian-de-ci-shu-lcof].html

29 lines
690 B
HTML
Raw Normal View History

2023-12-09 18:53:53 +08:00
<p>给定一个整数 <code>num</code>,计算所有小于等于 <code>num</code> 的非负整数中数字 <code>1</code> 出现的个数。</p>
<p>&nbsp;</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>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= num &lt; 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>&nbsp;</p>