You are viewing a single comment's thread. Return to all comments →
from collections import deque d = deque() N = int(input()) #number of operations for i in range(N): oper = list(input().split()) if oper[0] == 'append': d.append(int(oper[1])) elif oper[0] == 'appendleft': d.appendleft(int(oper[1])) elif oper[0] == 'pop': d.pop() elif oper[0] == 'popleft': d.popleft() else: print() print(*d)``
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Collections.deque()
You are viewing a single comment's thread. Return to all comments →