0

If I have multiple arrays of items, how can I calculate the combination of collections that are possible?

Ex:

a = [Red, Green, Blue]
b = [Small, Medium, Large, X-Large]
c = [Round, Square]

I'd like to know how many ways these groupings can be combined, ex:

[Red, Small, Round]
[Red, Small, Square]
[Red, Medium, Round]
[Red, Medium, Square]
...

And so on...

There could be more than just these 3 arrays.

Any advice would be greatly appreciated.

Nathan
  • 103

1 Answers1

0

Use the Counting Principle. Basically, you multiply the number of elements in each array.

AlgorithmsX
  • 4,560