• + 3 comments

    Interesting problem.. if (arr.length %2 == 0 ){ return 0; } int result = 0; for (int i =0; i< arr.length; i++){ if(i%2 == 0 ){ result ^= arr[i]; }

    If you generate the all possible sub arrays..It's easy to understand the logic.