For some reason, I'm having a hard time with this one. I like puzzles, but I'm not doing so well on this one.
The following array can have a large number of sets inside of it, but never deeper than what you see in this example (i.e., never deeper than 2 dimensions):
var list = [['a', 'b'], ['c'], ['d', 'e']];
With the above as input, how do I produce the following array in JavaScript?
[['a', 'c', 'd'], ['a', 'c', 'e'], ['b', 'c', 'd'], ['b', 'c', 'e']]
I'm sure the solution involves recursion, but it's not a simple tree structure, so it's not as simple as it looks.