3 ms·
You could use a modified version of merge sort where if an element already exists you don't add it (you end up adding only unique elements), this will save the
by maury91 7y ago
You could use a modified version of merge sort where if an element already exists you don't add it (you end up adding only unique elements), this will save the extra O(n) where you remove the duplicates.