✔ Brute Force || C++
\nclass Solution {\npublic:\n    vector<int> executeInstructions(int n, vector<int>& startPos, string s) {\n        \n        \n        \n        vector<int> an
```\nclass Solution {\npublic:\n    vector<int> executeInstructions(int n, vector<int>& startPos, string s) {\n        \n        \n        \n        vector<int> ans;\n        \n        \n        for(int i=0;i<s.size();i++){\n            \n            int x = startPos[0];\n            int y = startPos[1];\n            int j=i;\n            int count=0;\n            \n            while(true){\n                \n                if(x>=n || x<0 || y>=n || y<0) break;\n                if(s.size()==j) break;\n                \n                if(s[j]==\'L\'){\n                    y-=1;\n                }\n                else if(s[j]==\'R\'){\n                    y+=1;\n                }\n                else if(s[j]==\'U\'){\n                    x-=1;\n                }\n                else if(s[j]==\'D\'){\n                    x+=1;\n                }\n                \n                j+=1;\n                if(x<n and x>=0 and y<n and y>=0){\n                     count+=1;\n                }\n            }\n            \n            \n            ans.push_back(count);\n        }\n        \n         \n        return ans;\n    }\n};\n```
['C', 'C++']