Which collections type provides O(1) appends and pops from both ends in Python?
Correct answer
A. deque
7 views
A. deque
7 views
collections.deque is a double-ended queue optimised for fast operations at both ends.
Asked in: Python Interview Advanced
https://docs.python.org/3/library/index.htmlNot sure why the answer is A? Ask here and get an explanation.