Hello there, this is my 1st post in the site...

My problem follows:
I have an array M x N (eg 4 x 2)

1 X
X 2
1 2
X 2

What I want to do, is (USING RECURSION) to get all the possible vertical combinations (16 in the 4x2 example) as a (~) separated string. A few of the combinations are:
1 1 1 1
X X X X
1 1 2 2
X 2 X 2 ... and so on...

That is : "1X1X~1X12~1X2X~1X22~..."

TIA