The question is a little complex. The problem here is to get rid of duplicates and save the unique elements of array into another array with their original sequence.
O(n)
O(log n)
Finally, O(n log n) operation
O(n log n)