Python O(n) with comments and reasonings
\n\nclass Solution:\n    \'\'\'\n    1. The order of L and Rs in the start and end must be the same as L and R cannot cross one another. The allowed transformat
```\n\nclass Solution:\n    \'\'\'\n    1. The order of L and Rs in the start and end must be the same as L and R cannot cross one another. The allowed transformations are \n       equivalent to an L/R swapping position with an adjacent X (Left X for L and right X for R). In other words L and R can cross an X \n\t   (to the left and right respectively) but they can\'t cross one another.\n    2. Since an L can only cross to the left (of an X), in the destination the index of an L must be the same or less than that of the \n       corresponding L in start.\n    3. Similarly since an R can only cross to the Right, in the destination the index of an R must be the same or greater than that of the \n       corresponding R in start .\n    \'\'\'\n\t\n    def canTransform(self, start: str, end: str) -> bool:\n        \'\'\'\n        Check if order is the same (condition 1)\n        \'\'\'\n        if start.replace("X", "") != end.replace("X", ""):\n            return False\n        \n        \'\'\'\n        Check conditions 2 and 3\n        \'\'\'\n        startLIndexes = [i for i in range(len(start)) if start[i] == "L"]\n        startRIndexes = [i for i in range(len(start)) if start[i] == "R"]\n        endLIndexes = [i for i in range(len(end)) if end[i] == "L"]\n        endRIndexes = [i for i in range(len(end)) if end[i] == "R"]\n        \n        for i in range(len(startLIndexes)):\n            if endLIndexes[i] > startLIndexes[i]:\n                return False\n        \n        for i in range(len(startRIndexes)):\n            if endRIndexes[i] < startRIndexes[i]:\n                return False\n        \n        return True\n\n\n```
[]