MIN QUERY - 1(Segment Tree)

Why my code is showing TLE?

@a19JE0093
There was just one mistake in your code. While building the seg tree, you passed v by value. Because of which a lot of time will be spent in making copies of it which will lead to TLE. Pass it by reference or make it a global variable. Passing by reference saves a lot of time.

If my explanation was able to resolve your doubt, please mark the query as resolved.

Oh this is really a minute thing but you just teach me how to think to this much extent. Thank you so much!

1 Like

@a19JE0093
If my explanation was able to resolve your doubt, please mark the query as resolved.