Mark As Completed Discussion

Disclaimer:

We have a very similar problem that we recently covered, called the Uniqueness of an Array. It is advisable not to mix it up with our current problem as the former one is removing duplicate elements from an unsorted array. In our case, we have a sorted array and therefore, allows us to use the two-pointers approach for an optimized solution. Let's look at the trivial brute force approach first before exploring the optimized solution.