One pass O(n) Python Solution
We just need to keep track of two counters.\n\nclass Solution:\n    def canTransform(self, start: \'str\', end: \'str\') -> \'bool\':\n        countR = 0\n     
We just need to keep track of two counters.\n```\nclass Solution:\n    def canTransform(self, start: \'str\', end: \'str\') -> \'bool\':\n        countR = 0\n        countL = 0\n        for idx in range(len(start)):\n            if start[idx] == \'R\':\n                countR += 1\n            if end[idx] == \'L\':\n                countL += 1\n                \n            if countR > 0 and countL > 0:\n                return False\n            \n            if start[idx] == \'L\':\n                countL -= 1\n            if end[idx] == \'R\':\n                countR -= 1\n            \n            if countR < 0 or countL < 0:\n                return False\n        \n        return countR == 0 and countL == 0\n```
[]