Skip to content
Logo
Terrible Whiteboard

Solving Algorithms One Whiteboard at a Time

  • Home
  • Blog
  • Contact
  • Coupons and Discounts
  • Search

Factorial Trailing Zeroes | LeetCode 172

Uncategorized

AFFILIATE LINKS

Great resource I use to learn algorithms.
40% off Tech Interview Pro: http://techinterviewpro.com/terriblewhiteboard
20% off CoderPro: http://coderpro.com/terriblewhiteboard

Here is the full implementation.

let trailingZeroes = function(n) {
    let numberOfFives = 0;
    
    while (n >= 5) {
        numberOfFives += Math.floor(n / 5);
        n = Math.floor(n / 5);
    }
    
    return numberOfFives;
};

Post navigation

← Previous Post
Next Post →
Udemy Course: Data Structures and Algorithms

Recent Posts

  • Add Two Numbers | LeetCode 2
  • Odd Even Linked List | LeetCode 328
  • Find the Town Judge | LeetCode 997
  • Jump Game | LeetCode 55
  • Partition Equal Subset Sum | LeetCode 416

Archives

  • May 2020
  • April 2020
  • March 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019

Categories

  • Uncategorized
terriblewhiteboard@gmail.com
Copyright © 2025 Terrible Whiteboard