No solution in python (only partially correct)


#1

even the editorial solution in python is only giving partial correct answer. it is giving time limit error for the rest.


#2

If you are using list as a queue and using insert for inserting at start, it will give TLE.
However if you use deque and use popleft and append and appendleft, it gets accepted.

Looks like internally deque is faster.


#3

thanks @sprokr, my logic got accepted when using deque instead of pop(0)


#4

Faced the same issue. Thanks @sprokr.