Skip to content

Conversation

@gunescelil
Copy link

make solution like this

// write your code in Java SE 8
HashSet dups = new HashSet<>();

    for (int i = 0; i < A.length; i++)
    {
        if (!dups.add(A[i]))
        {           
            dups.remove((A[i]));
        } 
    }
    
    return (Integer) dups.toArray()[0];

make solution like this 

// write your code in Java SE 8
        HashSet<Integer> dups = new HashSet<>();

        for (int i = 0; i < A.length; i++)
        {
            if (!dups.add(A[i]))
            {           
                dups.remove((A[i]));
            } 
        }
        
        return (Integer) dups.toArray()[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant