172. Factorial Trailing Zeroes Posted on 2020-05-19 | Edited on 2021-01-22 | Views: https://leetcode.com/problems/factorial-trailing-zeroes/ Explanation: ref.1 ref.2 12345class Solution { public int trailingZeroes(int n) { return n==0?0:n/5+trailingZeroes(n/5); }} 12345678910111213141516/* factorial -> overflowclass Solution { public int trailingZeroes(int n) { String facNum=String.valueOf(fac((long)n)); int cnt=0; for(int i=facNum.length()-1;i>=0;i--){ if(facNum.charAt(i)=='0') cnt++; if(facNum.charAt(i)!='0') break; } return cnt; } public long fac(long n){ if(n<=1) return 1; return n*fac(n-1); }}*/