For an integer N find the number of trailing zeroes in N!.
Example 1:
Input:
N = 5
Output:
1
Explanation:
5! = 120 so the number of trailing zero is 1.
Example 2:
Input:
N = 4
Output:
0
Explanation:
4! = 24 so the number of trailing zero is 0.
Your Task:  
You don't need to read input or print anything. Your task is to complete the function trailingZeroes() which take an integer N as an input parameter and returns the count of trailing zeroes in the N!.
Expected Time Complexity: O(logN)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N <= 10^{9}

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3

class Solution:
    def trailingZeroes(self, N):
    	#code here 

Solutions:
import re
import math

class Solution:

	def trailingZeroes(self, N):
		triling_zero = 0
		while N:
			triling_zero += N // 5
			N = N // 5
		return triling_zero


class Solution:

	def trailingZeroes(self, N):
		res = 0
		while N >= 5:
			N //= 5
			res += N
		return res


class Solution:

	def trailingZeroes(self, N):
		if N < -1:
			return -1
		count = 0
		while N >= 5:
			N //= 5
			count += N
		return count


class Solution:

	def trailingZeroes(self, N):
		r = 0
		n = 5
		while n <= N:
			r += int(N / n)
			n = n * 5
		return r


class Solution:

	def trailingZeroes(self, N):
		result = 0
		x = N
		while x > 4:
			x = x // 5
			result += x
		return result


class Solution:

	def trailingZeroes(self, N):
		count = 0
		while N >= 5:
			count = count + N // 5
			N //= 5
		return count


class Solution:

	def trailingZeroes(self, n):
		if n < 0:
			return -1
		if n <= 4:
			return 0
		count = 0
		while n >= 5:
			n = n // 5
			count += n
		return count


class Solution:

	def trailingZeroes(self, N):
		count = 0
		i = 5
		while N / i >= 1:
			count += int(N / i)
			i *= 5
		return int(count)


import math

class Solution:

	def trailingZeroes(self, N):
		x = 5
		count = 0
		while x <= N:
			count += N // x
			x *= 5
		return count


class Solution:

	def trailingZeroes(self, N):
		c = 0
		n5 = N - N % 5
		p = 1
		while n5 / 5 ** p >= 1:
			c += int(n5 / 5 ** p)
			p += 1
		return c


import math

class Solution:

	def trailingZeroes(self, N):
		zeros = 0
		i = 5
		while i <= N:
			zeros += N // i
			i *= 5
		return zeros


from math import factorial

class Solution:

	def trailingZeroes(self, N):
		s = 0
		while N >= 5:
			N //= 5
			s += N
		return s


class Solution:

	def trailingZeroes(self, N):
		tz = 0
		while N != 0:
			tz += int(N / 5)
			N = int(N / 5)
		return tz


class Solution:

	def trailingZeroes(self, N):
		power = 5
		c = 0
		while N >= power:
			c += N // power
			power *= 5
		return c


class Solution:

	def trailingZeroes(self, N):
		ans = 0
		i = 5
		while i <= N:
			ans += N // i
			i *= 5
		return ans


class Solution:

	def trailingZeroes(self, N):
		temp = 5
		ans = 0
		while temp <= N:
			ans += N // temp
			temp *= 5
		return ans


import math

class Solution:

	def trailingZeroes(self, N):
		res = 0
		i = 1
		while math.pow(5, i) <= N:
			res += N // math.pow(5, i)
			i += 1
		return int(res)


import math

class Solution:

	def trailingZeroes(self, n):
		count = 0
		while n >= 5:
			n //= 5
			count += n
		return count


class Solution:

	def trailingZeroes(self, N):
		if N < 0:
			return -1
		if N <= 4:
			return 0
		ct = 0
		while N >= 5:
			N = N // 5
			ct += N
		return ct


from math import factorial

class Solution:

	def trailingZeroes(self, n):
		if n < 5:
			return 0
		return n // 5 + self.trailingZeroes(n // 5)


class Solution:

	def trailingZeroes(self, n):
		if n < 5:
			return 0
		return n // 5 + self.trailingZeroes(n // 5)


class Solution:

	def trailingZeroes(self, N):
		m = N
		i = 5
		t = 0
		while m // i >= 1:
			t += m // i
			i *= 5
		return t


class Solution:

	def trailingZeroes(self, n):
		ans = 0
		while n >= 5:
			n //= 5
			ans += n
		return ans


class Solution:

	def trailingZeroes(self, N):
		c = 0
		i = 5
		while N // i >= 1:
			c += N // i
			i *= 5
		return c


class Solution:

	def trailingZeroes(self, N):
		x = 5
		c = 0
		while x <= N:
			c += N // x
			x *= 5
		return c


import math

class Solution:

	def trailingZeroes(self, N):
		ans = 0
		for i in range(int(math.log(N))):
			ans += N // 5 ** (i + 1)
		return ans


class Solution:

	def trailingZeroes(self, N):
		result = 0
		while N >= 5:
			N //= 5
			result += N
		return result


class Solution:

	def trailingZeroes(self, N):
		sum = 0
		i = 5
		while i <= N:
			sum += N // i
			i *= 5
		return sum


class Solution:

	def trailingZeroes(self, N):
		n = N
		res = 0
		i = 5
		while i <= N:
			res += N // i
			i *= 5
		return res


class Solution:

	def trailingZeroes(self, N):
		five = 0
		i = 5
		while i <= N:
			five += N // i
			i *= 5
		return five


class Solution:

	def trailingZeroes(self, N):
		total = 0
		i = 5
		while i <= N:
			total += N // i
			i *= 5
		return total


class Solution:

	def trailingZeroes(self, n):
		count_zero = 0
		i = 5
		while n / i > 0:
			count_zero += n // i
			i = i * 5
		return count_zero


class Solution:

	def trailingZeroes(self, N):
		ans = 0
		while True:
			a = N // 5
			ans += a
			N = a
			if N <= 0:
				break
		return ans


class Solution:

	def trailingZeroes(self, N):
		count = 0
		i = 5
		while i <= N:
			count += N // i
			i *= 5
		return count
val = Solution()
val.trailingZeroes(5)


class Solution:

	def trailingZeroes(self, N):
		x = 5
		cnt = 0
		while x <= N:
			cnt += N // x
			x *= 5
		return cnt


class Solution:

	def trailingZeroes(self, n):
		c = 0
		i = 5
		while n / i >= 1:
			c = c + int(n / i)
			i = i * 5
		return c


class Solution:

	def trailingZeroes(self, n):
		ans = 0
		i = 5
		while n // i >= 1:
			count = int(n / i)
			i *= 5
			ans += count
		return ans


class Solution:

	def trailingZeroes(self, N):
		if N < 5:
			return 0
		else:
			k = 0
			while N > 1:
				N = N // 5
				k = k + N
			return k


class Solution:

	def trailingZeroes(self, N):
		k = N
		c5 = 0
		while k > 0:
			count = k // 5
			k = count
			c5 += count
		k = N
		c2 = 0
		while k > 0:
			count = k // 2
			k = count
			c2 += count
		return c5 if c5 < c2 else c2


class Solution:

	def trailingZeroes(self, n):
		c = 0
		while n >= 5:
			n //= 5
			c += n
		return c