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' 카테고리의 다른 글
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 |
3190. Find Minimum Operations to Make All Elements Divisible by Three (0) | 2024.09.19 |
leetcode 3280. Convert Date to Binary (1) | 2024.09.12 |
댓글