Answer:
If you remember the algorithm for mergesort, you should be able to solve this problem. While merging the subarrays and comparing elements, add an extra condition which is "if the elements are equal, remove one of them." Done!
Possible Solution Code(in Python):
The above code outputs an array [1, 2, 3, 4, 5, 8, 9, 10, 14]. Good Luck!

No comments:
Post a Comment