[Python3] 2 lines w/ notes and examples || T/M: 99% / 91%
Notes:\n\nThe problem could be rephrased as:\n\n"Each robot travels d units left or right based on whether its corresponding element in s is L or R, respectivel
# Notes:\n\nThe problem could be rephrased as:\n\n"Each robot travels `d` units left or right based on whether its corresponding element in `s` is `L` or `R`, respectively. Find the sum of the distances based on these final positions."\n\nThe expression `(ord(c) - 79) // 3 * d` maps \'L\' to `-d` and \'R\' to `d`.\n\nIt is left to the curious and algebraically capable reader to justify why, in the example, the inner product of `[-7, -2, 3, 6]` and `[-3, -1, 1, 3]` gives us the correct answer.\n\n\n# Code\n```python\nclass Solution:\n    def sumDistance(self, nums: List[int], s: str, d: int) -> int:\n        nums = sorted([i + (ord(c) - 79)// 3 * d for i, c in zip(nums, s)])\n        return sum(map(lambda x, y: x * y, nums, range(1 - len(nums), len(nums), 2))) % 1000000007\n```
['Array', 'Brainteaser', 'Sorting', 'Prefix Sum', 'Python', 'C++', 'Java', 'Python3']