Driver Code
let arr = [ 2 , 3 , 2 , 4 , 4 , 6 , 3 , 2 ] ; let N = arr . length ; let left = new Array ( N ) ; let right = new Array ( N ) ; preprocess ( arr , N , left , right ) ; let L = 0 ; let R = 2 ; if ( isSubarrayMountainForm ( arr , left , right , L , R ) ) document . write ( " " + " " + " " ) ; else document . write ( " " + " " + " " ) ; L = 1 ; R = 3 ; if ( isSubarrayMountainForm ( arr , left , right , L , R ) ) document . write ( " " + " " ) ; else document . write ( " " + " " ) ;