https://leetcode.com/problems/find-the-encrypted-string/description/
1
2
3
4
5
6
7
8
|
class Solution:
def getEncryptedString(self, s: str, k: int) -> str:
answer = ""
for i in range(len(s)):
answer += s[(i+k)%len(s)]
return answer
|
cs |
문자열 s 를 rotate 하는 느낌으로 구현
반응형
'python-algorithm' 카테고리의 다른 글
백준 32154 SUAPC 2024 Winter (1) | 2024.10.27 |
---|---|
3300. Minimum Element After Replacement With Digit Sum (0) | 2024.10.05 |
3194. Minimum Average of Smallest and Largest Elements (0) | 2024.09.21 |
3232. Find if Digit Game Can Be Won (0) | 2024.09.21 |
3285. Find Indices of Stable Mountains (0) | 2024.09.21 |
댓글