Utility function to count array elements required to be removed to make array a mountain array
public static int minRemovalsUtil ( int [ ] arr ) { int result = 0 ; if ( arr . length < 3 ) { return - 1 ; }