You must sort the array first. Since this is a sorted array, any duplicates will be next to each other. So, start from the beginning and compare each element with its neighbor on the right. If there are no duplicates, you made n-2 comparisons, and you're done.
If you find a duplicate, you will have a hole. Since this is an array, not a list of links, you will need to move each element down. (You can create a new array if it was allowed.) However, you do not just want to start moving everything, you can simply mark with a pointer or counter where the hole is and move on to the next comparison. When you get the next non-duplicate, you move (copy) this element into the hole and increase the hole counter by 1.
source share