I have a matrix like:
0 | 1 | 2 | 3
-------------
7 | 6 | 5 | 4
-------------
8 | 9 | A | B
-------------
F | E | D | C
in code:
var matrix = new char[][]
{
new char[] { '0', '1', '2', '3' },
new char[] { '7', '6', '5', '4' },
new char[] { '8', '9', 'A', 'B' },
new char[] { 'F', 'E', 'D', 'C' }
};
I need to get all possible combination of this matrix with 5 chars each, but every char must be the next immediate neighbor, for instance, 0,5 and 4,8 are invalid but 0,6 and 3,4 are valid.
This matrix will not be static as is in the sample, it is generated with the hex numbers in any position every time.
Thanks!