Skip to content

Instantly share code, notes, and snippets.

@amejiarosario
Created January 13, 2020 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amejiarosario/23778653056826d460c23d38d7304ba9 to your computer and use it in GitHub Desktop.
Save amejiarosario/23778653056826d460c23d38d7304ba9 to your computer and use it in GitHub Desktop.
getPermutations('ab') // ab, ba...
// n = 2, f(n) = 2;
getPermutations('abc') // abc, acb, bac, bca, cab, cba...
// n = 3, f(n) = 6;
getPermutations('abcd') // abcd, abdc, acbd, acdb, adbc, adcb, bacd...
// n = 4, f(n) = 24;
getPermutations('abcde') // abcde, abced, abdce, abdec, abecd, abedc, acbde...
// n = 5, f(n) = 120;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment