You are viewing a single comment's thread. Return to all comments →
from collections import deque n = int(input()) d = deque() for n in range(n): cmd = input().split() operation = cmd[0] if operation == "append": d.append(int(cmd[1])) elif operation == "appendleft": d.appendleft(int(cmd[1])) elif operation == "pop": d.pop() elif operation == "popleft": d.popleft() print(*d)
Seems like cookies are disabled on this browser, please enable them to open this website
Collections.deque()
You are viewing a single comment's thread. Return to all comments →