Check whether an Array can be made 0 by splitting and merging repeatedly | Java program for the above approach ; 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
class GFG { public static String solve ( int [ ] A ) { int i , ctr = 0 ; for ( i = 0 ; i < A . length ; i ++ ) { if ( A [ i ] % 2 == 1 ) { ctr ++ ; } } if ( ctr % 2 == 1 ) { return " No " ; } else { return " Yes " ; } } public static void main ( String [ ] args ) { int [ ] arr = { 9 , 17 } ; System . out . println ( solve ( arr ) ) ; } }