Javascript Solution | Faster than 87% | T: O(n^2)
\n//     Time: O(n^2)\nvar executeInstructions = function(n, startPos, s) {\n    let answers = []; \n    for (i = 0; i < s.length; i++) { \n        let movement
```\n//     Time: O(n^2)\nvar executeInstructions = function(n, startPos, s) {\n    let answers = []; \n    for (i = 0; i < s.length; i++) { \n        let movement = 0;\n        let [row, col] = startPos;\n        for (j = i; j < s.length; j++) { \n            if (s[j] == "R") col++;\n            else if (s[j] == "L") col--;\n            else if (s[j] == "D") row++;\n            else row--;\n            if(row>n-1 || col > n-1 || row < 0 || col < 0) {\n                break;\n            }\n            movement++;\n        }\n        answers[i] = movement;\n    }\n    return answers;\n};\n```\n
['JavaScript']