Example 1:
Input: 3 output: 0 Explanation: 3! = 6, there are no zeros in the mantissa.
Example 2:
Input: 5 output: 1 Explanation: 5! = 120, there is 1 zero in the mantissa.
code section
class Solution { public int trailingZeroes(int n) { if (n < 5) { return 0; } int count = 0; int len = n / 5; for (int i = 1; i <= len; i++) { count = count + split(5 * i); } return count; } public static int split(int n) { if (n < 5) { return 0; } int len = 0; boolean flag = true; while (flag) { if (n / 5 < 5) { flag = false; } if (n / 5 % 5 == 0) { n = n / 5; } else { flag = false; } len ++ ; } return len; } }