Skip to content

Instantly share code, notes, and snippets.

@kylefeng
Created July 3, 2013 05:12
Show Gist options
  • Save kylefeng/5915599 to your computer and use it in GitHub Desktop.
Save kylefeng/5915599 to your computer and use it in GitHub Desktop.
import itertools
import functools
def min(x):
fn = lambda lst: int(''.join(map(str, lst)))
return fn(functools.reduce(lambda x,y: fn(x) < fn(y) and x or y, itertools.permutations(x)))
print(min([9,12,34]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment