1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-27 02:30:28 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/阶乘后的零 [factorial-trailing-zeroes].html

41 lines
865 B
HTML
Raw Normal View History

2022-03-27 20:56:26 +08:00
<p>给定一个整数 <code>n</code> ,返回 <code>n!</code> 结果中尾随零的数量。</p>
<p>提示&nbsp;<code>n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>n = 3
<strong>输出:</strong>0
<strong>解释:</strong>3! = 6 ,不含尾随 0
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>n = 5
<strong>输出:</strong>1
<strong>解释:</strong>5! = 120 ,有一个尾随 0
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>n = 0
<strong>输出:</strong>0
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= n &lt;= 10<sup>4</sup></code></li>
</ul>
<p>&nbsp;</p>
<p><b>进阶:</b>你可以设计并实现对数时间复杂度的算法来解决此问题吗?</p>