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 | 31 |
Tags
- gs25
- hackerrank
- leetcode
- Kaggle
- 프로그래머스
- 프로그래머스 파이썬
- ChatGPT
- SW Expert Academy
- 코로나19
- github
- programmers
- 편스토랑
- 파이썬
- 금융문자분석경진대회
- 맥북
- Real or Not? NLP with Disaster Tweets
- Baekjoon
- 우분투
- 백준
- Docker
- 자연어처리
- 더현대서울 맛집
- 데이콘
- ubuntu
- Git
- dacon
- AI 경진대회
- 캐치카페
- PYTHON
- 편스토랑 우승상품
Archives
- Today
- Total
목록
반응형
258. Add Digits (1)
반응형
솜씨좋은장씨
[leetCode] 258. Add Digits (Python)
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Input: 38 Output: 2 Explanation: The process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. Follow up: Could you do it without any loop/recursion in O(1) runtime? Solution class Solution: def addDigits(self, num: int) -> int: while True: if num // 10 < 1: return n..
Programming/코딩 1일 1문제
2020. 10. 8. 19:36
반응형