Here have a array set:
totalarray =[
[1,2,3,4],
[8,9,10],
[15,16,17],
[8,14,20]
]
And I need to make it combine if which set have a same number.
like that:
totalarray =[
[1,2,3,4],
[8,9,10,14,20],
[15,16,17]
]
Other example:
totalarray =[
[1,2,3,4],
[6,10,19],
[6,16,4],
[4,14,20]
]
to
totalarray =[
[1,2,3,4,6,10,14,16,19,20]
]
So, I need to make it if any number match on other array and make it to together. e.g:
Array = [[1,2,3,4],[8,9,10],[8,11,12]];
Array[1][0] and Array[2][0] is match, so Array will become Array = [1,2,3,4],[8,9,10,11,12].
Any suggestion?