Help plz 💔 I need java code "remove the duplicate elements in array" using only for /if/while 😫 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help plz 💔 I need java code "remove the duplicate elements in array" using only for /if/while 😫

x=[1,2,2,2,3,5,3] ==== x=[1,2,3,5]

31st Oct 2017, 4:59 PM
tuqa mohammad
tuqa mohammad - avatar
2 Answers
+ 3
Just use a set and it will automatically remove duplicates. example: Set<T> mySet = new HashSet<T>(Arrays.asList(someArray));
31st Oct 2017, 5:26 PM
Witty Phantom
Witty Phantom - avatar
0
with out set 💔😭 only for loop and if statement
31st Oct 2017, 5:58 PM
tuqa mohammad
tuqa mohammad - avatar