Skip to content

Instantly share code, notes, and snippets.

@csgregorian
Created August 28, 2014 03:19
Show Gist options
  • Save csgregorian/b5b7ff541f93679205c7 to your computer and use it in GitHub Desktop.
Save csgregorian/b5b7ff541f93679205c7 to your computer and use it in GitHub Desktop.
a = [5,1,4,2,3]
b = [2,5,3,1,4]
num_shifts = 0
def f(i):
global a
if a[i] != b[i]:
cow = a[b.index(a[i])]
a[b.index(a[i])] = a[i]
f(b.index(cow))
for i in range(len(a)):
f(i)
print(a)
print(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment