You are viewing a single comment's thread. Return to all comments →
Python 3 solution:
queue = [] number_of_queries = int(input()) for _ in range(number_of_queries): query_and_data = input() query_and_data_split = query_and_data.split() if len(query_and_data_split) == 2: queue += [int(query_and_data_split[1])] elif int(query_and_data_split[0]) == 2: queue = queue[1:] elif int(query_and_data_split[0]) == 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 solution: