Easy Python Solution Based on Spiral Matrix I and II
Intuition\n Describe your first thoughts on how to solve this problem. \nAfter every iteration of a row or column we need to widen our range.\nIf the first row 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nAfter every iteration of a row or column we need to widen our range.\nIf the first row we\'re reading is length of two when we read if in reverse direction we need to add one more element to it.\nEg. Lets read a row in to the left direction then when we eventually try to read in the reverse that is to the right direction. We include one more element. 1->2 then 5<-4<-3\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n*m)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n*m)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def spiralMatrixIII(self, rows: int, cols: int, rStart: int, cStart: int) -> List[List[int]]:\n        ans = []\n        left, right = cStart, cStart+1\n        top, bottom = rStart, rStart+1\n        current = 1\n        move = 0\n        while current <= rows*cols:\n            # fill top\n            for i in range(left+move, right+1):\n                if self.inbound(top, i, rows, cols):\n                    ans.append([top, i])\n                    current += 1\n            left -= 1\n            # fill right\n            for i in range(top+1, bottom+1):\n                if self.inbound(i, right, rows, cols):\n                    ans.append([i, right])\n                    current += 1\n            top -= 1\n            # fill bottom\n            for i in range(right-1, left-1, -1):\n                if self.inbound(bottom, i, rows, cols):\n                    ans.append([bottom, i])\n                    current += 1\n            right += 1\n            # fill left\n            for i in range(bottom-1, top-1, -1):\n                if self.inbound(i, left, rows, cols):\n                    ans.append([i, left])\n                    current += 1\n            bottom += 1\n            move = 1\n        return ans\n    def inbound(self, r, c, rows, cols):\n        return 0<=r<rows and 0<=c<cols\n```
['Python', 'Python3']