Minimum removals to make array sum odd | Function to find minimum removals ; Count odd numbers ; If the counter is odd return 0 otherwise return 1 ; Driver Code
function findCount ( arr , n ) { var countOdd = 0 ; for ( var i = 0 ; i < n ; i ++ ) if ( arr [ i ] % 2 == 1 ) countOdd ++ ; if ( countOdd % 2 == 0 ) return 1 ; else return 0 ; } var arr = [ 1 , 2 , 3 , 5 , 1 ] ; var n = arr . length ; document . write ( findCount ( arr , n ) ) ;