Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second letter of commands is unique solution in Clear category for Digit Stack by MMM_AAA_NNN
def digit_stack(commands):
stack = []
sum = 0
for command in commands:
if command[1] == "U":
stack.append(command[5])
if command[1] == "E" and stack:
sum += int(stack[-1])
if command[1] == "O" and stack:
sum += int(stack.pop())
return sum
March 24, 2015