diff --git a/build.py b/build.py index e69de29..9ca16f4 100644 --- a/build.py +++ b/build.py @@ -0,0 +1,18 @@ +def is_rotation(s1,s2): + if s1 == None or s2 == None: + return False + if s1 == '': + if s2 == '': + return True + return False + + for index in range(len(s1)): +# Keep iterating through the 1st index and keep pushing the 1st value to the last. +# if the string matches to the 2nd string then it its rotational. +# i = 0 --> s[0:] + s[] = s2 ? -- ABCD + [] = CDAB (No) +# i = 1 --> s[1:] + s[1] = s2? --- BCD + A = CDAB (No) +# i = 2 --> s[2:] + s[0:2] = s2? -- CD + AB = CDAB (Yes) +# Hence rotational + if s1[index:]+s1[0:index] == s2: + return True + return False diff --git a/build.pyc b/build.pyc new file mode 100644 index 0000000..027ab18 Binary files /dev/null and b/build.pyc differ diff --git a/tests/__init__.pyc b/tests/__init__.pyc new file mode 100644 index 0000000..0e0be32 Binary files /dev/null and b/tests/__init__.pyc differ diff --git a/tests/test_is_rotation.pyc b/tests/test_is_rotation.pyc new file mode 100644 index 0000000..8f8b5de Binary files /dev/null and b/tests/test_is_rotation.pyc differ