L-R queries : SQRT Decomposition

I was trying to solve L-R Queries using Sqrt Decomposition. I got WA as result of my submission.
Can anyone help me out in figuring out mistakes in my approach?

Problem Code: LRQUER

Link to the problem: LRQUER

Link to my solution: solution

In your get() function, how do you handle the case where L and R are both in the same block?

It looks as though you always iterate from L to the end of the block containing L, and then from the start of the block containing R to R.

1 Like

Thanks for the help, I got it.