old_contents: # Time:  O(n)
  # Space: O(1)
  
  class ZigzagIterator(object):
  
      def __init__(self, v1, v2):
          """
          Initialize your q structure here.
          :type v1: List[int]
          :type v2: List[int]
          """
          self.q = collections.deque([(len(v), iter(v)) for v in (v1, v2) if v])
  
      def next(self):
          """
          :rtype: int
          """
          len, iter = self.q.popleft()
          if len > 1:
              self.q.append((len-1, iter))
          return next(iter)
  
      def hasNext(self):
          """
          :rtype: bool
          """
          return bool(self.q)
  
  # Your ZigzagIterator object will be instantiated and called as such:
  # i, v = ZigzagIterator(v1, v2), []
  # while i.hasNext(): v.append(i.next())
  
new_contents: # Time:  O(n)
  # Space: O(k)
  
  class ZigzagIterator(object):
  
      def __init__(self, v1, v2):
          """
          Initialize your q structure here.
          :type v1: List[int]
          :type v2: List[int]
          """
          self.q = collections.deque([(len(v), iter(v)) for v in (v1, v2) if v])
  
      def next(self):
          """
          :rtype: int
          """
          len, iter = self.q.popleft()
          if len > 1:
              self.q.append((len-1, iter))
          return next(iter)
  
      def hasNext(self):
          """
          :rtype: bool
          """
          return bool(self.q)
  
  # Your ZigzagIterator object will be instantiated and called as such:
  # i, v = ZigzagIterator(v1, v2), []
  # while i.hasNext(): v.append(i.next())
  
subject: Update zigzag-iterator.py