In other to achieve this, I need an empty array to store the unique value while iterating through the sorted array. To achieve this uniqueness, I compared the previous element to the next one and made sure they are not the same before storing it in the unique array.
Below is the screen shot of the whole approach.
Top comments (1)
I think screenshot is not attached 😅