You are viewing a single comment's thread. Return to all comments →
from collections import deque d=deque() for _ in range(int(input())): n=input().split() if n[0]=="append": d.append(int(n[-1])) elif n[0]=="appendleft": d.appendleft(int(n[-1])) elif n[0]=="pop": d.pop() elif n[0]=="popleft": d.popleft() print(" ".join(map(str, list(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 →