Minimum element left from the array after performing given operations | Java implementation of the above approach ; Function to return the minimum possible value of the last element left after performing the given operations ; Driver code
import java . util . * ; class GFG { static int getMin ( int arr [ ] , int n ) { int minVal = Arrays . stream ( arr ) . min ( ) . getAsInt ( ) ; return minVal ; } public static void main ( String [ ] args ) { int arr [ ] = { 5 , 3 , 1 , 6 , 9 } ; int n = arr . length ; System . out . println ( getMin ( arr , n ) ) ; } }