https://ide.codingblocks.com/#/s/29725
what is the error in my code only 1 test case is not passsed
Https://ide.codingblocks.com/#/s/29725
please add the problem link…
you solved it in O(N*Q). i used O(N) approach to solve it. See this. Because constraints say N<10^5 and Q<10^5, but the cases were weak.