I’ve been trying to solve this problem from CF lately: Circular RMQ
I implemented a Segment Tree and used lazy propogation for solving this problem. But two different implementations I’ve made both fail on the 5th case. The 1st one failed to correctly answer the 30th query, the second, even though answers the 30th query correctly(local manual testing) doesn’t answer the 25th query correctly.
My code is here. Does anyone know how I can debug such a data structure easily, as all test cases(small ones) seem to get answered correctly. Any clues/ideas would be appreciated.
Thanks and regards!