How to remove duplicate value in array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to remove duplicate value in array?

Without deleting the first value.. 😊😊

27th Apr 2018, 2:29 AM
Bulb
Bulb - avatar
2 Answers
+ 3
In Java and C++ you can use a set, which by definition has no duplicates. Here's a solution for JavaScript: https://stackoverflow.com/questions/9229645/remove-duplicate-values-from-js-array?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
27th Apr 2018, 2:36 AM
Emma
0
You create an array of elements you've already seen.
27th Apr 2018, 4:38 AM
Timon Paßlick