Simplest Python Solution O(n)
\'\'\'\nclass Solution:\n    def canTransform(self, start: str, end: str) -> bool:\n        \n        so , eo , sind, eind = [],[],[],[]\n        for i in range
\'\'\'\nclass Solution:\n    def canTransform(self, start: str, end: str) -> bool:\n        \n        so , eo , sind, eind = [],[],[],[]\n        for i in range(len(start)):\n            if start[i] != \'X\':\n                so.append(start[i])\n                sind.append(i)\n            if end[i] != \'X\':\n                eo.append(end[i])\n                eind.append(i)\n        if so != eo:\n            return False\n        \n        for j in range(len(so)):\n            if so[j] == \'L\' and eind[j]>sind[j]:\n                return False\n            if so[j] == \'R\' and eind[j]<sind[j]:\n                return False\n        \n        return True\n\'\'\'\nThe idea is to initialy check whether the starting and the ending position have the same order of R and L configuration. We can imagine that X is the space that L and R can move along the array. So, we can check whether we can move R to the right or L to the left with the provided space.
['Python', 'Python3']