Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
functools.cmp_to_key solution in Clear category for Bigger Together by Phil15
from functools import cmp_to_key
str_compare = lambda s1, s2: int(s1 + s2) - int(s2 + s1)
def bigger_together(ints):
ints = sorted(map(str, ints), key = cmp_to_key(str_compare))
return int(''.join(reversed(ints))) - int(''.join(ints))
Sept. 24, 2018
Comments: