Skip to content

Instantly share code, notes, and snippets.

@amejiarosario
Created January 13, 2020 22:32
Show Gist options
  • Select an option

  • Save amejiarosario/23778653056826d460c23d38d7304ba9 to your computer and use it in GitHub Desktop.

Select an option

Save amejiarosario/23778653056826d460c23d38d7304ba9 to your computer and use it in GitHub Desktop.

Revisions

  1. amejiarosario created this gist Jan 13, 2020.
    8 changes: 8 additions & 0 deletions examples-permutations-5-letters.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    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;