If a part of this segment overlaps with the given range
int mid = ( ss + se ) / 2 ; int q1 = RMQUtil ( 2 * index + 1 , ss , mid , qs , qe , st ) ; int q2 = RMQUtil ( 2 * index + 2 , mid + 1 , se , qs , qe , st ) ; if ( q1 == -1 ) return q2 ; else if ( q2 == -1 ) return q1 ; return ( level [ q1 ] < level [ q2 ] ) ? q1 : q2 ; }