1
2
3
4
5
6
7
8
9
10
11
12
13
|
class Solution:
def getLucky(self, s: str, k: int) -> int:
str_num=''
for i in s:
str_num+=str(ord(i)-96)
int_num=0
for _ in range(k):
for i in str_num:
int_num+=int(i)
str_num=str(int_num)
int_num=0
return(int(str_num))
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 2215. Find the Difference of Two Arrays (0) | 2022.07.08 |
---|---|
leetcode 2303. Calculate Amount Paid in Taxes (0) | 2022.07.07 |
백준 25305 커트라인 (0) | 2022.07.07 |
leetcode 2236. Root Equals Sum of Children (0) | 2022.07.07 |
leetcode 128. Longest Consecutive Sequence (0) | 2022.07.06 |
댓글