I am writing an algorithm for university. And I have almost everything except the last thing. I now have jagged array of numbers, example of this array:
[0][1]
[1][11,12]
[2][3,7,11,15]
[3][6,7,10,11]
And i need to remove duplicates, like delete every number from all next rows, that is present in the previos row. Output should be something like this:
[0][1]
[1][11,12]
[2][3,7,15]
[3][6,10]
I have tried something like this:
for (int i = 0; i <= numbers.Length + 1; i++)
{
int size = numbers[i].Length;
for (int j = 0; j < size; j++)
{
if (numbers[i][numbers[i].Length] != numbers[i + 1][numbers[i + 1].Length])
{
newNumbers[i][j] = numbers[i][j];
}
}
}
But it does not work the way it should.

[0] [1] [2] [3]part of array, or just indexes?