Skip to content

Commit 05bac51

Browse files
committed
Is String Rotated
1 parent 22bdeed commit 05bac51

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Google/Problem#747.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""
2+
Given two strings A and B, return whether or not A can be shifted some number of times to get B.
3+
For example, if A is abcde and B is cdeab, return true. If A is abc and B is acb, return false.
4+
"""
5+
def is_rotation(A, B):
6+
if len(A) != len(B):
7+
return False
8+
9+
return B in A + A

0 commit comments

Comments
 (0)