✅ [Python] Simple Solution || Brute Force || Clean and Easy to Understand
PLEASE UPVOTE if you like \uD83D\uDE01 If you have any question, feel free to ask. \n\nclass Solution(object):\n    def executeInstructions(self, n, startPos, s
**PLEASE UPVOTE if you like** \uD83D\uDE01 **If you have any question, feel free to ask.** \n```\nclass Solution(object):\n    def executeInstructions(self, n, startPos, s):\n        d = {\'R\': (0, 1), \'D\': (1, 0), \'L\': (0, -1), \'U\': (-1, 0)}\n        ans = [0] * len(s)\n        for i in range(len(s)):\n            [x, y] = startPos\n            for j in range(i, len(s)):\n                x += d[s[j]][0]\n                y += d[s[j]][1]\n                if 0 <= x < n and 0 <= y < n:\n                    ans[i] += 1\n                else:\n                    break\n        return ans\n```
[]