Skip to content

Instantly share code, notes, and snippets.

@amejiarosario
Created January 13, 2020 22:16
Show Gist options
  • Save amejiarosario/e104c919e3ff2d1193c736f21150f2df to your computer and use it in GitHub Desktop.
Save amejiarosario/e104c919e3ff2d1193c736f21150f2df to your computer and use it in GitHub Desktop.
powerset('') // ...
// n = 0, f(n) = 1;
powerset('a') // , a...
// n = 1, f(n) = 2;
powerset('ab') // , a, b, ab...
// n = 2, f(n) = 4;
powerset('abc') // , a, b, ab, c, ac, bc, abc...
// n = 3, f(n) = 8;
powerset('abcd') // , a, b, ab, c, ac, bc, abc, d, ad, bd, abd, cd, acd, bcd...
// n = 4, f(n) = 16;
powerset('abcde') // , a, b, ab, c, ac, bc, abc, d, ad, bd, abd, cd, acd, bcd...
// n = 5, f(n) = 32;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment