Check whether an Array can be made 0 by splitting and merging repeatedly | Function that finds if it is possible to make the array contain only 1 element i . e . 0 ; Check if element is odd ; According to the logic in above approach ; Driver code
function solve ( A ) { let i , ctr = 0 ; for ( i = 0 ; i < A . length ; i ++ ) { if ( A [ i ] % 2 ) { ctr ++ ; } } if ( ctr % 2 ) { return " " ; } else { return " " ; } } let arr = [ 9 , 17 ] ; document . write ( solve ( arr ) ) ;