Skip to content

Instantly share code, notes, and snippets.

@jraines
Last active August 29, 2015 14:27
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 jraines/67462aa9419d9b55db27 to your computer and use it in GitHub Desktop.
Save jraines/67462aa9419d9b55db27 to your computer and use it in GitHub Desktop.
combinations_problem
You have a set A of n integers.
For every i ∈ A,
i may or may not also belong to a replacement set B, which may be the empty set,
where any k ∈ B can replace i in the original set.
Each replacement set B can be of any size.
Is there a way (especially an efficient way) to generate
all combinations of size n (call it A') where:
all unique combinations A' where order is not important.
Each i ∈ A' should also not be repeated within a given A'
Note that A' could be entirely composed of integers from replacements sets, no
original member of A need be preserved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment