def hasNext(self):
        # update
        while self.i < len(self.vec2d) and self.j >= len(self.vec2d[self.i]):
            self.i += 1
            self.j = 0

        return self.i < len(self.vec2d) and self.j < len(self.vec2d[self.i])
This function structures the two pointers.
dataset/ETHPy150Open algorhythms/LeetCode/251 Flatten 2D Vector.py/Vector2D.hasNext