Count pairs with Bitwise AND as ODD number | JavaScript program to count pairs with Odd AND ; Count total odd numbers in ; return count of even pair ; Driver main ; calling function findOddPair and print number of odd pair
function findOddPair ( A , N ) { let count = 0 ; for ( let i = 0 ; i < N ; i ++ ) if ( ( A [ i ] % 2 == 1 ) ) count ++ ; return count * ( count - 1 ) / 2 ; } let a = [ 5 , 1 , 3 , 2 ] ; let n = a . length ; document . write ( findOddPair ( a , n ) ) ;