Check if all array elements can be removed by the given operations | C ++ program to implement the above approach ; Function to check if it is possible to remove all array elements ; Condition if we can remove all elements from the array ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void removeAll ( int arr [ ] , int n ) { if ( arr [ 0 ] < arr [ n - 1 ] ) cout << " YES " ; else cout << " NO " ; } int main ( ) { int Arr [ ] = { 10 , 4 , 7 , 1 , 3 , 6 } ; int size = sizeof ( Arr ) / sizeof ( Arr [ 0 ] ) ; removeAll ( Arr , size ) ; return 0 ; }