Ask Question
26 June, 08:01

g 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) None of the mentioned

+4
Answers (1)
  1. 26 June, 08:42
    0
    a) Print the duplicate elements in the array

    Explanation:

    I found this code:

    This is two for cycle, where we make a comparison among two variables i and j to print duplicate elements.

    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])

    }

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “g what does the following piece of code do a) Print the duplicate elements in the array b) Print the element with maximum frequency c) ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers