Two test cases passed;
One test case shows TLE
Link to my code:
Kindly help, Thanks in advance
Two test cases passed;
One test case shows TLE
Link to my code:
Kindly help, Thanks in advance
hey sagnik
just update the while loop as while(q-- && q>-1)
and make the data type as long long int.
everything else is working fine
Thanks, @AASTHA011 this update worked.
But I still wonder why did you ask me to change :
while(q- -) --> while(q-- && q>-1)
Because while(q- -) also should run q times accepting q queries
and it is specified in the constraints that 1<=Q<=10^4
So why was there a need to change the while loop condition?
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.