标签:leetcode
https://oj.leetcode.com/problems/factorial-trailing-zeroes/
public class Solution { public int trailingZeroes(int n) { if (n <= 0) return 0; // Invalid input. // How many 5s, 25s, 125s ... int base = 5; int fives = 0; do { fives += n / d; base *= 5; } while (base <= n); return fives; } }
[LeetCode]172 Factorial Trailing Zeroes
标签:leetcode
原文地址:http://7371901.blog.51cto.com/7361901/1601319