Skip to content

Instantly share code, notes, and snippets.

@wilcoln
Last active December 9, 2018 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilcoln/ad97cd95ce58af48e809d0970e83211e to your computer and use it in GitHub Desktop.
Save wilcoln/ad97cd95ce58af48e809d0970e83211e to your computer and use it in GitHub Desktop.
Google string problem
def areCircular(s1,s2):
result = False
size = len(s1)
nbPermut = size
tmp = s1
while( not result and nbPermut > 0):
circularPermutation = []
for i in range(size):
circularPermutation.append(tmp[(i - 1)%size])
tmp = ''.join(circularPermutation)
if(s2 == tmp):
result = True
nbPermut-=1
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment