Driver Code
public static void main ( String [ ] args ) { int arr [ ] = { 2 , 3 , 2 , 4 , 4 , 6 , 3 , 2 } ; int N = arr . length ; int left [ ] = new int [ N ] ; int right [ ] = new int [ N ] ; preprocess ( arr , N , left , right ) ; int L = 0 ; int R = 2 ; if ( isSubarrayMountainForm ( arr , left , right , L , R ) ) System . out . println ( " Subarray ▁ is ▁ in ▁ mountain ▁ form " ) ; else System . out . println ( " Subarray ▁ is ▁ not ▁ in ▁ mountain ▁ form " ) ; L = 1 ; R = 3 ; if ( isSubarrayMountainForm ( arr , left , right , L , R ) ) System . out . println ( " Subarray ▁ is ▁ in ▁ mountain ▁ form " ) ; else System . out . println ( " Subarray ▁ is ▁ not ▁ in ▁ mountain ▁ form " ) ; } }