Compute the xor of elements from ( 1 , 1 ) to ( i , j ) and store it in prefix_xor [ i ] [ j ]
function prefix ( arr , prefix_xor , n ) { for ( var i = 1 ; i < n ; i ++ ) { for ( var j = 1 ; j < n ; j ++ ) {