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
- 맥북
- 캐치카페
- SW Expert Academy
- Docker
- Kaggle
- 우분투
- PYTHON
- leetcode
- 파이썬
- Baekjoon
- 프로그래머스
- Git
- AI 경진대회
- dacon
- 코로나19
- Real or Not? NLP with Disaster Tweets
- ChatGPT
- programmers
- gs25
- 편스토랑
- 데이콘
- 자연어처리
- 편스토랑 우승상품
- hackerrank
- 프로그래머스 파이썬
- 더현대서울 맛집
- 금융문자분석경진대회
- 백준
- ubuntu
- github
Archives
- Today
- Total
목록
반응형
504. Base 7 (1)
반응형
솜씨좋은장씨
[leetCode] 504. Base 7 (Python)
Given an integer, return its base 7 string representation. Example 1: Input: 100 Output: "202" Example 2: Input: -7 Output: "-10" Note: The input will be in range of [-1e7, 1e7]. Solution class Solution: def convertToBase7(self, num: int) -> str: if num == 0: return str(num) sign = 1 if num < 0: sign = -1 num = abs(num) answer = '' while num: answer = str(num % 7) + answer num //= 7 return ('-' ..
Programming/코딩 1일 1문제
2020. 10. 12. 22:06
반응형