Utility function to build segment tree
def buildSegTree ( low : int , high : int , pos : int ) -> list : NEW_LINE INDENT if low == high : NEW_LINE INDENT seg [ pos ] [ 0 ] = L [ low ] NEW_LINE seg [ pos ] [ 1 ] = low NEW_LINE return seg [ pos ] NEW_LINE DEDENT mid = low + ( high - low ) // 2 NEW_LINE buildSegTree ( low , mid , 2 * pos ) NEW_LINE buildSegTree ( mid + 1 , high , 2 * pos + 1 ) NEW_LINE seg [ pos ] = min ( seg [ 2 * pos ] , seg [ 2 * pos + 1 ] ) NEW_LINE DEDENT