Driver Code
static public void Main ( ) { 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 ) ) Console . WriteLine ( " Subarray ▁ is ▁ in ▁ " + " mountain ▁ form " ) ; else Console . WriteLine ( " Subarray ▁ is ▁ not ▁ " + " in ▁ mountain ▁ form " ) ; L = 1 ; R = 3 ; if ( isSubarrayMountainForm ( arr , left , right , L , R ) ) Console . WriteLine ( " Subarray ▁ is ▁ in ▁ " + " mountain ▁ form " ) ; else Console . WriteLine ( " Subarray ▁ is ▁ not ▁ " + " in ▁ mountain ▁ form " ) ; } }