I have the following problem, not from any ongoing or past contest. Can you help me, by suggesting what optimal methods you have to solve it.
Node has three properties: left, right, height
N Insert node queries. Each query is (l, r, h).
Now M queries ask following: L, R, H
For all nodes(l, r, h), that satisfy L <= l && r <= R,
return min( abs( H — h) )
Can you guys suggest some approaches that you have in mind?