C# Solution | Easy to understand, Brute force
C#\npublic class Solution {\n    public int[] ExecuteInstructions(int n, int[] startPos, string s) {\n        int[] ans = new int[s.Length];\n        for (int i
```C#\npublic class Solution {\n    public int[] ExecuteInstructions(int n, int[] startPos, string s) {\n        int[] ans = new int[s.Length];\n        for (int i = 0; i < s.Length; i++) {\n            int opsCount = 0;\n            int row = startPos[0], col = startPos[1];\n            while (row >= 0 && row < n && col >= 0 && col < n && i + opsCount < s.Length) {\n                char opChar = s[i + opsCount];\n                if (opChar == \'L\') col--;\n                else if (opChar == \'R\') col++;\n                else if (opChar == \'U\') row--;\n                else if (opChar == \'D\') row++;\n                \n                if (row >= 0 && row < n && col >= 0 && col < n) opsCount++;\n            }\n            \n            ans[i] = opsCount;\n        }\n        \n        return ans;\n    }\n}\n```
[]