Getting wrong ans for given test ccase

ans:-https://ide.codingblocks.com/s/406723

Check Now =>


Passing all test cases and have mention the error too.

initiliaze pre for every query will increase the complexity , like in video pre is initilaze before quieres but value is set using memset in quries

Yes it will increase, but when you are initialising outside the while loop of test case, make sure that after every test case you initialise all it’s indexes to 0. This will take O(N) time and initialising of array will also take O(N) time, so it will take O(N) anyhow, so it’s on you how you want to do it.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.