If the range is out of bounds , return - 1
if ( start > r or end < l ) : NEW_LINE INDENT return - 1 ; NEW_LINE DEDENT if ( start >= l and end <= r ) : NEW_LINE INDENT return segment_tree [ node ] ; NEW_LINE DEDENT mid = ( start + end ) // 2 ; NEW_LINE return max ( query ( start , mid , l , r , 2 * node + 1 ) , query ( mid + 1 , end , l , r , 2 * node + 2 ) ) ; NEW_LINE