We cancel the occurrence of a character if it occurs odd number times
var mask2 = mask ^ ( 1 << j ) ; if ( index [ mask2 ] ) { answer = Math . max ( answer , i - index [ mask2 ] ) ; } } } return answer ; }