Skip to content

Instantly share code, notes, and snippets.

@maxskorr
Created March 9, 2014 20:41
Show Gist options
  • Save maxskorr/9454239 to your computer and use it in GitHub Desktop.
Save maxskorr/9454239 to your computer and use it in GitHub Desktop.
backtrack
MAX = 5
l = dict(zip(range(0, MAX), [False for i in xrange(0, MAX)]))
def backtrack():
for k in xrange(0, MAX):
if not l[k]:
l[k] = True
print k,
backtrack()
l[k] = False
print ''
backtrack()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment