DEV Community

Ezekiel nwuguru
Ezekiel nwuguru

Posted on

Code to remove duplicates

Thought process:
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)

varshithvhegde profile image
Varshith V Hegde

I think screenshot is not attached 😅

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.