One pass O(n) Python, beat 99%, easy to understand
The idea is keep a variable count. For start, R plus 1, L minus 1, opposite for end. And they should meet two rules:\n1.The count could not be less than 0.\nOne
The idea is keep a variable ```count```. For ```start```, R plus 1, L minus 1, opposite for ```end```. And they should meet two rules:\n1.The count could not be less than 0.\nOne example is "XR" and "RX". Remember you can only replace strings in start, not end.\n2.The difference could never be 2 or -2.\nOne example is "RL" and "LR". The reason is to move the letter "R", you have to make sure there is always a "X" on the right of it. Same for "L".\n\n```\nclass Solution:\n    def canTransform(self, start: str, end: str) -> bool:\n        n = len(start)\n        value = {"R":1,"X":0,"L":-1}\n        count = 0\n        for i in range(n):\n            diff = value[start[i]]-value[end[i]]\n            count+=diff\n            if count < 0 or abs(diff) == 2:\n                return False\n        return count == 0\n```
[]