|
| 1 | +# leetcode-6426-movement-of-robots |
| 2 | + |
| 3 | +https://leetcode.com/problems/movement-of-robots |
| 4 | + |
| 5 | +**Type:** Classic |
| 6 | + |
| 7 | +## Run Code Result |
| 8 | + |
| 9 | +### Your input |
| 10 | + |
| 11 | +<!-- prettier-ignore --> |
| 12 | +```js |
| 13 | +[-2,0,2] |
| 14 | +"RLL" |
| 15 | +3 |
| 16 | +[1,0] |
| 17 | +"RL" |
| 18 | +2 |
| 19 | +``` |
| 20 | + |
| 21 | +### Your stdout |
| 22 | + |
| 23 | +<!-- prettier-ignore --> |
| 24 | +```js |
| 25 | +####### |
| 26 | +####### |
| 27 | +####### |
| 28 | +[ |
| 29 | + { index: 0, pos: -2, dir: 1 }, |
| 30 | + { index: 1, pos: 0, dir: -1 }, |
| 31 | + { index: 2, pos: 2, dir: -1 } |
| 32 | +] |
| 33 | +TIME 0 |
| 34 | +posWithRobots.length 1 |
| 35 | +posWithRobots.length 2 |
| 36 | +posWithRobots.length 1 |
| 37 | +posWithRobots { '1': [ 2 ], '-1': [ 0, 1 ] } |
| 38 | +posWithMultipleRobots Set(1) { -1 } |
| 39 | +[ |
| 40 | + { index: 0, pos: -1, dir: -1 }, |
| 41 | + { index: 1, pos: -1, dir: 1 }, |
| 42 | + { index: 2, pos: 1, dir: -1 } |
| 43 | +] |
| 44 | +TIME 1 |
| 45 | +posWithRobots.length 1 |
| 46 | +posWithRobots.length 1 |
| 47 | +posWithRobots.length 2 |
| 48 | +posWithRobots { '0': [ 1, 2 ], '-2': [ 0 ] } |
| 49 | +posWithMultipleRobots Set(1) { 0 } |
| 50 | +[ |
| 51 | + { index: 0, pos: -2, dir: -1 }, |
| 52 | + { index: 1, pos: 0, dir: -1 }, |
| 53 | + { index: 2, pos: 0, dir: 1 } |
| 54 | +] |
| 55 | +TIME 2 |
| 56 | +posWithRobots.length 1 |
| 57 | +posWithRobots.length 1 |
| 58 | +posWithRobots.length 1 |
| 59 | +posWithRobots { '1': [ 2 ], '-3': [ 0 ], '-1': [ 1 ] } |
| 60 | +posWithMultipleRobots Set(0) {} |
| 61 | +[ |
| 62 | + { index: 0, pos: -3, dir: -1 }, |
| 63 | + { index: 1, pos: -1, dir: -1 }, |
| 64 | + { index: 2, pos: 1, dir: 1 } |
| 65 | +] |
| 66 | +distance -3 -1 2 |
| 67 | +distance -3 1 4 |
| 68 | +distance -1 1 2 |
| 69 | +####### |
| 70 | +####### |
| 71 | +####### |
| 72 | +[ { index: 0, pos: 1, dir: 1 }, { index: 1, pos: 0, dir: -1 } ] |
| 73 | +TIME 0 |
| 74 | +posWithRobots.length 1 |
| 75 | +posWithRobots.length 1 |
| 76 | +posWithRobots { '2': [ 0 ], '-1': [ 1 ] } |
| 77 | +posWithMultipleRobots Set(0) {} |
| 78 | +[ { index: 0, pos: 2, dir: 1 }, { index: 1, pos: -1, dir: -1 } ] |
| 79 | +TIME 1 |
| 80 | +posWithRobots.length 1 |
| 81 | +posWithRobots.length 1 |
| 82 | +posWithRobots { '3': [ 0 ], '-2': [ 1 ] } |
| 83 | +posWithMultipleRobots Set(0) {} |
| 84 | +[ { index: 0, pos: 3, dir: 1 }, { index: 1, pos: -2, dir: -1 } ] |
| 85 | +distance 3 -2 5 |
| 86 | +``` |
| 87 | + |
| 88 | +### Your answer |
| 89 | + |
| 90 | +**Time Limit Exceeded when submitting.** |
| 91 | + |
| 92 | +<!-- prettier-ignore --> |
| 93 | +```js |
| 94 | +8 |
| 95 | +5 |
| 96 | +``` |
0 commit comments