You are viewing a single comment's thread. Return to all comments →
My answer in Python
q = int(input()) inpts = [] for i in range(q): inpts.append(input()) ans = [] for i in inpts: if i[0] == "1": j, num = i.split(" ") ans.append(int(num)) elif i[0] == "2": ans.pop(0) elif i[0] == "3": print(ans[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 →
My answer in Python