Easiest c++ solution
\nclass Solution {\npublic:\n    vector<int> executeInstructions(int n, vector<int>& startPos, string s) {\n        int x,y,i,j,k,nn=s.length();\n        vector
```\nclass Solution {\npublic:\n    vector<int> executeInstructions(int n, vector<int>& startPos, string s) {\n        int x,y,i,j,k,nn=s.length();\n        vector<int> v;\n        for(i=0;i<nn;i++){\n            k=0;\n            x=startPos[1];\n            y=startPos[0];\n            for(j=i;j<nn;j++){\n                if(s[j]==\'R\')\n                    x++;\n                if(s[j]==\'L\')\n                    x--;\n                if(s[j]==\'U\')\n                    y--;\n                if(s[j]==\'D\')\n                    y++;\n                \n                if(x<0 or x>=n or y<0 or y>=n)\n                    break;\n                else\n                    k++;\n            }\n            v.push_back(k);\n        }\n        return v;\n    }\n};\n```
['C']