text: Build the Segment Tree from the given array
code: let st = constructST ( arr , n ) ; let Q = [ [ 1 , 3 ] , [ 0 , 2 ] ] ; for ( let i = 0 ; i < Q . length ; i ++ ) { let max = getMax ( st , n , Q [ i ] [ 0 ] , Q [ i ] [ 1 ] ) ; let ok = 0 ; for ( let j = 30 ; j >= 0 ; j -- ) { if ( ( max & ( 1 << j ) ) != 0 ) ok = 1 ; if ( ok <= 0 ) continue ; max |= ( 1 << j ) ; } document . write ( max + " " ) ; }