60% fast C++ solution
class Solution {\npublic:\n    vector executeInstructions(int n, vector& startPos, string s) {\n        int count=0;\n        vector answer;\n        int y=star
class Solution {\npublic:\n    vector<int> executeInstructions(int n, vector<int>& startPos, string s) {\n        int count=0;\n        vector<int> answer;\n        int y=startPos[0],x=startPos[1];\n        for(int i=0;i<s.length();i++){\n            count=0;\n            y=startPos[0],x=startPos[1];\n            for(int j=i;j<s.length();j++){\n                if(s[j]==\'R\'){x++;}\n                else if(s[j]==\'L\'){x--;}\n                else if(s[j]==\'U\'){y--;}\n                else{y++;}\n                \n                if((x<n&&x>=0)&&(y<n&&y>=0)){count++;}\n                else{break;}\n            }\n            answer.push_back(count);\n        }\n        return answer;\n    }\n};
[]