Basic approach
\n# Approach\n Describe your approach to solving the problem. \njust find for one complete circle and just that\nnote how circle is moving \n\n# Code\n\nclass S
\n# Approach\n<!-- Describe your approach to solving the problem. -->\njust find for one complete circle and just that\nnote how circle is moving \n\n# Code\n```\nclass Solution {\npublic:\n    // Tip:- total element are rows * cols\n    vector<vector<int>> spiralMatrixIII(int rows, int cols, int rStart, int cStart) {\n        int count = rows*cols;\n        int i=rStart,j=cStart;\n        int k=1;\n        vector<vector<int>> ans;\n        \n        while (count > 0) {\n            for (int temp=0 ; temp<k ; temp++) {\n                if (i>=0 && i<rows && j>=0 && j<cols) {\n                    ans.push_back({i, j});\n                    count--;\n                }\n                j++;\n            }\n\n            for (int temp = 0; temp < k; ++temp) {\n                if (i>=0 && i<rows && j>=0 && j<cols) {\n                    ans.push_back({i, j});\n                    count--;\n                }\n                i++;\n            }\n\n            k++;\n\n            for (int temp = 0; temp < k; ++temp) {\n                if (i>=0 && i<rows && j>=0 && j<cols) {\n                    ans.push_back({i, j});\n                    count--;\n                }\n                j--;\n            }\n\n            for (int temp = 0; temp < k; ++temp) {\n                if (i>=0 && i<rows && j>=0 && j<cols) {\n                    ans.push_back({i, j});\n                    count--;\n                }\n                i--;\n            }\n            k++;\n        }\n\n        return ans;\n    }\n};\n```
['C++']