Driver code
public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 2 , 2 , 1 , 1 } ; int n = arr . length ; int ans = minSteps ( arr , 0 , 0 , n ) ; if ( ans >= 9999999 ) { System . out . println ( - 1 ) ; } else { System . out . println ( ans ) ; } } }