본문 바로가기
python-algorithm

leetcode 796. Rotate String

by 무적김두칠 2022. 4. 18.

1
2
3
4
5
6
7
8
class Solution:
    def rotateString(self, s: str, goal: str-> bool:
        ans=False
        for i in range(len(s)):
            s=s[1:]+s[0]
            if s == goal :
                ans = True; break
        return ans
cs
반응형

댓글