Check whether an Array can be made 0 by splitting and merging repeatedly | C ++ 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
#include <bits/stdc++.h> NEW_LINE using namespace std ; string solve ( vector < int > & A ) { int i , ctr = 0 ; for ( i = 0 ; i < A . size ( ) ; i ++ ) { if ( A [ i ] % 2 ) { ctr ++ ; } } if ( ctr % 2 ) { return " No " ; } else { return " Yes " ; } } int main ( ) { vector < int > arr = { 9 , 17 } ; cout << solve ( arr ) << endl ; return 0 ; }