Why Dynamic Segment Tree? As know for segment tree, the space complexity is is up to 4n, which n is upper bound of data range. However, :-(, n some times becomes very large, such as 10^9 or infinity. OOM problem would occur if we allocate 4n size array for que…