Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Double ended solution in Clear category for Letter Queue by veky
def letter_queue(commands):
import collections
queue = collections.deque()
for command in commands:
if command.startswith("PUSH"):
queue.append(command[-1])
elif queue:
queue.popleft()
return "".join(queue)
July 2, 2014
Comments: