Let's say that there is given 2D array:
[
["A"],
["B"],
["C"],
["A", "C"],
["B", "C"]
]
I would like to get combination of sub-arrays but without duplicates on 1D elements level .
Each combination have to contain all strings elements( there will be always single element subArray - in that case ["A"], ["B"], ["C"]).
For this scenario the result would be:
[
[ ["A"], ["B"], ["C"], ],
[ ["A"], ["B", "C"] ],
[ ["B"], ["A", "C"] ],
]
Without:
[
// same combination
[ ["A"], ["C"], ["B"], ],
[ ["B"], ["A"], ["C"], ],
...
[ ["B", "C"], ["A"] ],
[ ["A", "C"], ["B"] ],
// duplicated "A"
[ ["A"], ["A", "C"] ],
...
]