It just gets better


#1
    Arrays.sort(A);

for(int i=0;i<A.length-1;i+=3){
if(A[i]!=A[i+1]){
return A[i];
}
}
return A[A.length-1];


#2

"Note: Your algorithm should have a linear runtime complexity."
Sorting is O(n*log(n)) always, so your solution works, but does not meet the required criteria.