Python O(n) two pointers with comments faster than 99%
The key is to figure out that we can ignore the Xs, but the relative position of the Ls and Rs must be equal in both strings. \n\nSo think of it as if the Ls ca
The key is to figure out that we can ignore the `X`s, but the relative position of the `L`s and `R`s must be equal in both strings. \n\nSo think of it as if the `L`s can only "move" backwards:\n```\nstart: XXXXL\n        <--L\nend:   LXXXX\n```\nand the `R`s can only "move" forward:\n```\nstart: RXXXX\n       R-->\nend:   XXXXR\n```\nSo we can scan the characters, skipping the `X`s, verifying that the next non-X character is equal in both strings. Later we have to make sure that:\n* If the current character is `L`, the index in `start` must be greater or equal to the index in `end` (can only "move" backwards in the `start` string).\n* If the current character is `R`, the index in `start` must be smaller or equal to the index in `end` (can only "move" forward in the `start` string).\n\nTime complexity: O(n)\nSpace complexity: O(1)\n\n```\n        i = j = 0\n        n = len(start)\n        while i < n or j < n:\n            \n            # Skip "X" chars\n            while i < n and start[i] == "X":\n                i += 1\n            while j < n and end[j] == "X":\n                j += 1\n                            \n            # Reached the end of only one string\n            if i != j and (i == n or j == n):\n                return False\n            \n            # Reached the end of both strings\n            if i == j and i == n:\n                return True\n            \n            # After skipping the Xs, the characters\n            # in both strings must be equal\n            if start[i] != end[j]:\n                return False\n            \n            # "L" can only move backwards,\n            # so if the current chars are "L",\n            # the index of `end` must be less or equal\n            # to the index of `start`\n            if start[i] == "L" and j > i:\n                return False\n            \n            # "R" can only move forward,\n            # so if the current chars are "R",\n            # the index of `end` must be greater or equal\n            # to the index of `start`\n            if start[i] == "R" and j < i:\n                return False\n            \n            i += 1\n            j += 1\n            \n        return True\n```
['Two Pointers', 'Python']