Bitwise XOR of Bitwise AND of all pairs from two given arrays | Function to find the Bitwise XOR of Bitwise AND of all pairs from the arrays arr1 [ ] and arr2 [ ] ; Stores the result ; Iterate over the range [ 0 , N - 1 ] ; Iterate over the range [ 0 , M - 1 ] ; Stores Bitwise AND of the pair { arr1 [ i ] , arr2 [ j ] } ; Update res ; Return the res ; Input
function findXORS ( arr1 , arr2 , N , M ) { let res = 0 ; for ( let i = 0 ; i < N ; i ++ ) { for ( let j = 0 ; j < M ; j ++ ) { let temp = arr1 [ i ] & arr2 [ j ] ; res ^= temp ; } } return res ; } let arr1 = [ 1 , 2 , 3 ] ; let arr2 = [ 6 , 5 ] ; let N = arr1 . length ; let M = arr2 . length ; document . write ( findXORS ( arr1 , arr2 , N , M ) ) ;