dimiTree's blog

By dimiTree, history, 3 years ago, In English

We are given n disjoint, finite sets.

We would like to count the amount of all possible subsets, while having the following restriction: we are only allowed to include a max of one element each out of every of our n disjoint sets.

My initial thought was to count all possible subsets of size {0, 1, ..., n} and sum them up.

Code

There is probably a much more elegant and efficient solution out there.

Feel free to share your ideas!

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it