18 ms·
Or, you know, just use a `collections.deque`, which is designed for fast ("approximately O(1)") pops from either end of the list.
by akx 13y ago
Or, you know, just use a `collections.deque`, which is designed for fast ("approximately O(1)") pops from either end of the list.