Pyhton Bruteforce
\nclass Solution:\n    def executeInstructions(self, n: int, startPos: List[int], s: str) -> List[int]:\n                    \n        res = []\n        i = 0\n
```\nclass Solution:\n    def executeInstructions(self, n: int, startPos: List[int], s: str) -> List[int]:\n                    \n        res = []\n        i = 0\n        while i < len(s) :\n            count = 0\n            curr_r = startPos[0]\n            curr_c = startPos[1]\n            \n            for j in range(i,len(s)):\n                \n                if s[j] == \'R\' :\n                    if curr_c+1 in range(n) :\n                        count += 1\n                        curr_c += 1\n                    else:\n                        break\n                        \n                elif s[j] == \'L\' :\n                    if curr_c-1 in range(n) :\n                        count += 1\n                        curr_c -= 1\n                    else:\n                        break\n                    \n                elif s[j] == \'D\' :\n                    if curr_r+1 in range(n) :\n                        count += 1\n                        curr_r += 1\n                    else:\n                        break\n                \n                elif s[j] == \'U\' :\n                    if curr_r-1 in range(n) :\n                        count += 1\n                        curr_r -= 1\n                    else:\n                        break\n            res.append(count)\n            i += 1\n        return res\n```
[]