Finding unpaired number in an odd length Array of integers
Sorting of the array will take O(n (log n)) in the average case. You can do it in linear time using bitwise operation

public class Test {
    public static void main(){
        int a = 0;
        int[] arr = {9,3,9,3,9,7,9};

        for (int i = 0; i &lt; arr.length; i++ ){
            a = a ^ arr[i];
        }

        System.out.println(a);
    }
}


Any number which will XOR with 0 will be the number itself. But if it will XOR with itself, it will be 0. In the end, we'll get the non paired number.