Nguyễn Tuấn Dương
New member
What does the following piece of code do?
A. Print the duplicate elements in the array
B. Print the element with maximum frequency
C. Print the unique elements in the array
D. Prints the element with minimum frequnecy
Code:
for (int i = 0; i < arr.length-1; i++)
{
for (int j = i+1; j < arr.length; j++)
{
if( (arr[i].equals(arr[j])) && (i != j) )
{
System.out.println(arr[i]);
}
}
}
B. Print the element with maximum frequency
C. Print the unique elements in the array
D. Prints the element with minimum frequnecy