Https://ide.codingblocks.com/s/87844

why does this code show timelimit to all test cases? i dont think i have increased the time complexity of the code.

In the question, you are not given no of test cases, but in your code, you have taken test case… remove tht…
secondly your while condition is wrong
while(i<N && j>=0)