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
- Git
- 프로그래머스 파이썬
- leetcode
- Baekjoon
- PYTHON
- 캐치카페
- 금융문자분석경진대회
- 백준
- Docker
- 더현대서울 맛집
- hackerrank
- gs25
- github
- 데이콘
- 자연어처리
- SW Expert Academy
- 편스토랑 우승상품
- 코로나19
- ChatGPT
- 맥북
- Real or Not? NLP with Disaster Tweets
- 우분투
- AI 경진대회
- 파이썬
- dacon
- 프로그래머스
- programmers
- 편스토랑
- Kaggle
- ubuntu
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
반응형