java.lang.Object
g0101_0200.s0172_factorial_trailing_zeroes.Solution

public class Solution extends Object
172 - Factorial Trailing Zeroes.<p>Medium</p> <p>Given an integer <code>n</code>, return <em>the number of trailing zeroes in</em> <code>n!</code>.</p> <p>Note that <code>n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> n = 3</p> <p><strong>Output:</strong> 0</p> <p><strong>Explanation:</strong> 3! = 6, no trailing zero.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> n = 5</p> <p><strong>Output:</strong> 1</p> <p><strong>Explanation:</strong> 5! = 120, one trailing zero.</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> n = 0</p> <p><strong>Output:</strong> 0</p> <p><strong>Constraints:</strong></p> <ul> <li><code>0 <= n <= 10<sup>4</sup></code></li> </ul> <p><strong>Follow up:</strong> Could you write a solution that works in logarithmic time complexity?</p>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • trailingZeroes

      public int trailingZeroes(int n)