TLE matchstick

Was trying to solve MSTICK Problem - CodeChef by Segment tree but still TLE pops up…:(.
Heres my code .plz help me out…:frowning:
CodeChef: Practical coding for everyone

1 Like

One suggestion to the solution is do integer operation at each node of the segment tree. Floating point operations are more complex and takes more time to operate. Just store the maximum and the minimum values of the ranges which are integer values. That would work fine.

1 Like