Can anyone explain this code i don't get it .I have solved this question using hashmap


#1

public int majorityElement(final List A) {
Collections.sort(A);

    return A.get(A.size() / 2);
}

}