Skip to content

Instantly share code, notes, and snippets.

@xiazhibin
Created March 4, 2018 13:52
Show Gist options
  • Save xiazhibin/5650acd8d00ba355df00e072362c3235 to your computer and use it in GitHub Desktop.
Save xiazhibin/5650acd8d00ba355df00e072362c3235 to your computer and use it in GitHub Desktop.
排列
def ngetmprint(list, ans, m):
if m == len(list):
ans = ans + list
print ans
elif m == 0:
print ans
else:
ngetmprint(list[1:], ans + list[0:1], m - 1)
ngetmprint(list[1:], ans, m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment