solve maximixing XOR problem