Check if all array elements can be removed by the given operations | Java 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
class GFG { static void removeAll ( int arr [ ] , int n ) { if ( arr [ 0 ] < arr [ n - 1 ] ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } public static void main ( String [ ] args ) { int Arr [ ] = { 10 , 4 , 7 , 1 , 3 , 6 } ; int size = Arr . length ; removeAll ( Arr , size ) ; } }