You are viewing a single comment's thread. Return to all comments →
from collections import deque queue = deque() queries = int(input()) for _ in range(queries): query = list(map(int, input().split())) match query[0]: case 1: queue.append(query[1]) case 2: queue.popleft() case 3: print(queue[0])
Seems like cookies are disabled on this browser, please enable them to open this website
Queue using Two Stacks
You are viewing a single comment's thread. Return to all comments →
Python 3 (v3.10+)