Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 편스토랑
- Git
- Real or Not? NLP with Disaster Tweets
- programmers
- ubuntu
- 편스토랑 우승상품
- 금융문자분석경진대회
- hackerrank
- dacon
- 더현대서울 맛집
- Docker
- 코로나19
- gs25
- PYTHON
- 데이콘
- 맥북
- Kaggle
- github
- 백준
- 프로그래머스 파이썬
- SW Expert Academy
- Baekjoon
- 프로그래머스
- 자연어처리
- 캐치카페
- 파이썬
- AI 경진대회
- leetcode
- ChatGPT
- 우분투
Archives
- Today
- Total
솜씨좋은장씨
[leetCode] 172. Factorial Trailing Zeroes (Python) 본문
728x90
반응형

Given an integer n, return the number of trailing zeroes in n!.
Example 1:
Input: 3
Output: 0
Explanation: 3! = 6, no trailing zero.
Example 2:
Input: 5
Output: 1
Explanation: 5! = 120, one trailing zero.
Note: Your solution should be in logarithmic time complexity.
Solution
class Solution:
def trailingZeroes(self, n: int) -> int:
answer = 0
while n:
n //= 5
answer += n
return answer



SOMJANG/CODINGTEST_PRACTICE
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[leetCode] 692. Top K Frequent Words (Python) (0) | 2020.07.23 |
---|---|
[leetCode] 386. Lexicographical Numbers (Python) (0) | 2020.07.22 |
[leetCode] 137. Single Number II (Python) (2) | 2020.07.20 |
[leetCode] 383. Ransom Note (Python) (0) | 2020.07.19 |
[leetCode] 9. Palindrome Number (Python) (0) | 2020.07.18 |