Enhanced Segment Tree to handle min and max queries on an interval