I'm looking for the best solution to remove duplicate objects from multi dimension array in objective-C (Swift is also fine) from some array like this:
muliDemensionArray = @[
@[@"1", @"2", @"3", @"4", @"4",],
@[@"11", @"13", @"24", @"14",],
@[@"1", @"3", @"24", @"21",],
];
Do we have any algorithm or solution from NSOrderedSet/NSMutableArray support us to do this without loop/ reduce loop as much as possible?
This is expected result to remove all duplicates across all arrays:
mutilDemensionArray = @[
@[@"1", @"2", @"3", @"4",],
@[@"11", @"13", @"24", @"14",],
@[@"21",],
];
- If we have many duplicate object, so keep the first one and remove others.
- I don't care about the order of objects in sub arrays, just care about the order of the sub arrays.