Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
twice faster :) solution in Speedy category for Letter Queue by blabaster
def letter_queue(commands):
queue, idx = [], 0
for c in commands:
if c == 'POP':
if idx < len(queue):
idx += 1
else:
queue.append(c[-1])
return ''.join(queue[idx:])
July 2, 2014
Comments: