I solved 380C - Sereja and Brackets using segment tree for logarithmic time complexity , but my my solution got TLE 11267626 for some test case . I want to ask if there is something wrong with my implementation or i have to use some other data structure ? P.S positive responses will be appreciated :)
UPD: Accepted: 11271890 :)
if you write it this way string str will be copied each time you call the build function, so total complexity is O(n^2).
You should change it to
P.S 11267959 Accepeted by changing only this char)
this was helpful thanks
It is just my personal opinon, but I think you should learn more basic concepts before segment tree. My suggestion is to learn better more basic concepts, then, after that, you should learn harder concepts.
You are about, 5 years to late