You are viewing a single comment's thread. Return to all comments →
from collections import deque n=int(input()) queue=deque() for _ in range(n): x= list(input().split()) match x[0]: case "append": queue.append(int(x[1])) case "appendleft": queue.appendleft(int(x[1])) case "pop": queue.pop() case "popleft": queue.popleft(); print(*queue)
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 →