solved using oop
Approach\n Describe your approach to solving the problem. \n- Here I created a class called as Spiral which is used for tracking at which row and column current
# Approach\n<!-- Describe your approach to solving the problem. -->\n- Here I created a class called as Spiral which is used for tracking at which row and column currently traversing.\n- And added Spiral methods like move east, south, west, north to modify it\'s current position.  \n- Then added a variable called as move to keep track of how much moves we need to traverse in each direction.\n- And used visited variable to keep track of visited elements count.\n\n# Complexity\n- Time complexity: $$O(rows * cols)$$ (for best case)\n- Time complexity: $$O(4 * rows * cols)$$ (for worst case)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Spiral:\n    def __init__(self, r, c):\n        self.row = r\n        self.col = c\n        self.move = 1\n        self.visited = 0\n\n    def move_east(self, rows, cols, ans):\n        for i in range(self.move):\n            self.col += 1\n            addSpiralCord(rows, cols, self, ans)\n    \n    def move_south(self, rows, cols, ans):\n        for i in range(self.move):\n            self.row += 1\n            addSpiralCord(rows, cols, self, ans)\n\n    def move_west(self, rows, cols, ans):\n        for i in range(self.move):\n            self.col -= 1\n            addSpiralCord(rows, cols, self, ans)\n    \n    def move_north(self, rows, cols, ans):\n        for i in range(self.move):\n            self.row -= 1\n            addSpiralCord(rows, cols, self, ans)\n\n    def is_in_range(self, rows, cols):\n        return self.row >= 0 and self.row < rows and self.col >= 0 and self.col < cols\n\n    def all_visited(self, rows, cols):\n        return self.visited == rows * cols\n\n    def __str__(self):\n        return f\'{self.row} {self.col} {self.move} {self.visited}\'     \n\n\nclass Solution:\n    def spiralMatrixIII(self, rows: int, cols: int, rStart: int, cStart: int) -> List[List[int]]:\n        spiral = Spiral(rStart, cStart)\n        ans = []\n\n        addSpiralCord(rows, cols, spiral, ans)\n\n        while spiral.visited < rows * cols:\n            spiral.move_east(rows, cols, ans)\n            spiral.move_south(rows, cols, ans)\n\n            spiral.move += 1\n            \n            spiral.move_west(rows, cols, ans)\n            spiral.move_north(rows, cols, ans)\n            \n            spiral.move += 1\n\n        return ans\n\n\ndef addSpiralCord(rows, cols, spiral, ans):\n    if spiral.is_in_range(rows, cols):\n        spiral.visited += 1\n        ans.append([spiral.row, spiral.col])\n\n```
['Matrix', 'Python3']