Amazon interview question

Segment Tree LC hard implementation