Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 424 Bytes

Question_172.md

File metadata and controls

22 lines (18 loc) · 424 Bytes

LeetCode Records - Question 172 Factorial Trailing Zeroes

Attempt 1: Count factor of 5

class Solution {
    public int trailingZeroes(int n) {
        int count = 0;
        int base = 5;

        while (base <= n) {
            count += n / base;
            base *= 5;
        }

        return count;
    }
}
  • Runtime: 0 ms (Beats: 100.00%)
  • Memory: 40.88 MB (Beats: 25.06%)