Driver code
int main ( ) { int a [ ] = { 1 , 0 , 2 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; bool possible = solve ( a , n ) ; if ( possible ) cout << " Yes " << endl ; else cout << " No " << endl ; return 0 ; }