Some robots are placed on a nums, a string s, and an integer d.
The robot at index i is initially positioned at nums[i] and begins moving in the direction indicated by s[i]. If s[i] is 'L', the robot moves to the left, and if s[i] is 'R', it moves to the right.
Every second, all robots move
Return the sum of the distances between all pairs of robots after
Note:
Robots change direction instantly upon collision without any loss of time. Collisions occur only when robots meet at the exact same position.
Constraints:
nums.length
nums[i]
d
nums.length s.length
s consists of 'L' and 'R' only
All elements in nums are unique
Some robots are placed on a nums, a string s, and an integer d.
The robot at index i is initially positioned at nums[i] and begins moving in the direction indicated by s[i]. If s[i] is 'L', the robot moves to the left, and if s[i] is 'R', it moves to the right.
Every second, all robots move
Return the sum of the distances between all pairs of robots after
Note:
Robots change direction instantly upon collision without any loss of time. Collisions occur only when robots meet at the exact same position.
Constraints:
nums.length
nums[i]
d
nums.length s.length
s consists of 'L' and 'R' only
All elements in nums are unique