int[] array = { 1, 0, 4, 1, 5, 3, 7, 8, 9, 1, 4 };
Say I want to find if two or more elements of the array are equal. I want to loop over the elements and check for duplicates.
for (int i = 0; i < array.length; i++)
{
for (int j = i + 1; j < array.length - i; j++)
{
if (array[i] == array[j])
// do something
}
}
Is this how we approach it or not? And
And another question: if we want to remove the duplicates, how exactly do we do that? A pseudo-code or something would be helpful.
Thanks in advance.

New Topic/Question
Reply



MultiQuote




|