Is there any simple way to remove duplicate elements in Java(will two loops work and how). Thank you:)
IN: int[] arr = {1,3,4,2,3,1,6,7,7};
Output i want is:
{1,3,4,2,6,7}
the only i know is we can traverse it through loop.
eg.
for(int i = 0;i < arr.length;i++){
for(int j = 0;j<arr.length;j++){
if( ){
//what logic i can apply here.
}
}
}
See Question&Answers more detail:os