Skip to content

Instantly share code, notes, and snippets.

@jbiason
Created March 3, 2017 19:43
Show Gist options
  • Save jbiason/23bb381c31806a270cedeb1268499512 to your computer and use it in GitHub Desktop.
Save jbiason/23bb381c31806a270cedeb1268499512 to your computer and use it in GitHub Desktop.
reorder = lambda eq: '+'.join(sorted(eq.split('+'), key=int))
# (’3+2+1+1’), ’1+1+2+3’
# (’1+2+3’), ’1+2+3’
# (’2+2’), ’2+2’
# (’1+3+2+3+2+1+3+2+3+1+2’), ’1+1+1+2+2+2+2+3+3+3+3’
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment