Python 3 | Simulation | Explanation
Explanation\n- Starting with a step length of 1, move one time to right, then turn; move one time to below\n- Increase step length, 1 + 1 = 2, move 2 times to l
### Explanation\n- Starting with a step length of `1`, move one time to right, then turn; move one time to below\n- Increase step length, `1 + 1 = 2`, move 2 times to left, then turn; move 2 times to above\n- So, for each step length, we will move `step` for 2 directions, then increase `step` by one; and repeat\n- To summarize:\n\t- `Step == 1, move*step, turn, move*step, turn`\n\t- `Step += 1, move*step, turn, move*step, turn`\n\t- `Step += 1, move*step, turn, move*step, turn`\n\t- `... ... repeat`\n### Implementation\n```\nclass Solution:\n    def spiralMatrixIII(self, rows: int, cols: int, rStart: int, cStart: int) -> List[List[int]]:\n        total, cnt, step, i = rows * cols, 1, 1, 0\n        ans = [[rStart, cStart]]\n        direction = {0: (0, 1), 1: (1, 0), 2: (0, -1), 3: (-1, 0)} # setup direction movements\n        while cnt < total:\n            for k in range(step):\n                rStart, cStart = rStart+direction[i][0], cStart + direction[i][1]\n                if 0 <= rStart < rows and 0 <= cStart < cols:\n                    ans.append([rStart, cStart])\n                    cnt += 1       # count visited \n            i = (i + 1) % 4        # changing direction\n            step += not i % 2      # increase step every 2 directions\n        return ans\n```
['Matrix', 'Simulation', 'Python', 'Python3']