If difference is negative , add N to it
if ( i - Aindex [ B [ i ] ] < 0 ) { if ( ! diff . hasOwnProperty ( A . length + i - Aindex [ B [ i ] ] ) ) { diff [ A . length + i - Aindex [ B [ i ] ] ] = 1 ; } else { diff [ A . length + i - Aindex [ B [ i ] ] ] += 1 ; } }