Skip to content

Commit 3b55b07

Browse files
solves trailing factorial zeroes in python
1 parent d378369 commit 3b55b07

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
| 169 | [Majority Element](https://leetcode.com/problems/majority-element) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](src/MajorityElement.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/majority_element.py) |
5252
| 170 | [Two Sum III - Data Structure Design](https://leetcode.com/problems/two-sum-iii-data-structure-design) | Easy | |
5353
| 171 | [Excel Sheet Column Number](https://leetcode.com/problems/excel-sheet-column-number) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](src/ExcelSheetColumnNumber.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/excel_sheet_column_number.py) |
54-
| 172 | [Factoring Trailing Zeroes](https://leetcode.com/problems/factorial-trailing-zeroes) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](src/FactorialTrailingZeros.java) |
54+
| 172 | [Factoring Trailing Zeroes](https://leetcode.com/problems/factorial-trailing-zeroes) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](src/FactorialTrailingZeros.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/factorial_trailing_zeroes.py) |
5555
| 189 | [Rotate Array](https://leetcode.com/problems/rotate-array) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](src/RotateArray.java) |
5656
| 190 | [Reverse Bits](https://leetcode.com/problems/reverse-bits) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](src/ReverseBits.java) |
5757
| 191 | [Number of One Bits](https://leetcode.com/problems/number-of-1-bits) | Easy | [![Java](https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png)](src/NumberOf1Bit.java) [![Python](https://img.icons8.com/color/35/000000/python.png)](python/number_of_1_bits.py) |

Diff for: python/factorial_trailing_zeroes.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution:
2+
def trailingZeroes(self, n: int) -> int:
3+
divisor, count = 5, 0
4+
while n // divisor > 0:
5+
count += n // divisor
6+
divisor *= 5
7+
return count

0 commit comments

Comments
 (0)