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
- 캐글
- Baekjoon
- Docker
- github
- Git
- 금융문자분석경진대회
- elasticsearch
- 코로나19
- hackerrank
- 캐치카페
- 자연어처리
- 백준
- SW Expert Academy
- 맥북
- NLP 대회
- Real or Not? NLP with Disaster Tweets
- AI 경진대회
- ubuntu
- programmers
- 편스토랑
- 데이콘
- 우분투
- Kaggle
- 프로그래머스
- 더현대서울 맛집
- leetcode
- PYTHON
- 파이썬
- dacon
- selenium
- Today
- 2,664
- Total
- 1,490,296
솜씨좋은장씨
[leetCode] 1945. Sum of Digits of String After Convert (Python) 본문
Programming/코딩 1일 1문제
[leetCode] 1945. Sum of Digits of String After Convert (Python)
솜씨좋은장씨 2022. 1. 27. 00:54반응형
코딩 1일 1문제! 오늘의 문제는 leetCode의 Sum of Digits of String After Convert 입니다.
Sum of Digits of String After Convert - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
👨🏻💻 코드 ( Solution )
class Solution:
def getLucky(self, s: str, k: int) -> int:
alphabet_list = list(s)
convert_str = []
for alpha in alphabet_list:
convert_str.append(str(ord(alpha) - ord('a') + 1))
convert_str = "".join(convert_str)
transform_num = list(convert_str)
for i in range(k):
transform_num = sum(list(map(int, transform_num)))
if i < k-1:
transform_num = list(str(transform_num))
return transform_num
GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07
1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.
github.com
반응형
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[BaekJoon] 2163번 : 초콜릿 자르기 (Python) (0) | 2022.01.29 |
---|---|
[leetCode] 2000. Reverse Prefix of Word (Python) (0) | 2022.01.28 |
[leetCode] 1945. Sum of Digits of String After Convert (Python) (0) | 2022.01.27 |
[leetCode] 2108. Find First Palindromic String in the Array (Python) (0) | 2022.01.26 |
[leetCode] 1291. Sequential Digits (Python) (0) | 2022.01.25 |
[leetCode] 2129. Capitalize the Title (Python) (0) | 2022.01.24 |
- Tag
- 1945. Sum of Digits of String After Convert leetCode Python, 1945. Sum of Digits of String After Convert leetCode 파이썬, 1945. Sum of Digits of String After Convert python, 1945. Sum of Digits of String After Convert Python 풀이, 1945. Sum of Digits of String After Convert 파이썬, 1945. Sum of Digits of String After Convert 파이썬 풀이, leetcode, leetCode 1945. Sum of Digits of String After Convert, leetCode 1945. Sum of Digits of String After Convert python
0 Comments