Java 2 pointers O(n)
\nclass Solution {\n    public boolean canTransform(String start, String end) {\n        int f = 0;\n        int s = 0;\n        while(f < start.length() || s <
```\nclass Solution {\n    public boolean canTransform(String start, String end) {\n        int f = 0;\n        int s = 0;\n        while(f < start.length() || s < end.length()) {\n            while(f < start.length() && start.charAt(f) == \'X\') f++;\n            while(s < end.length() && end.charAt(s) == \'X\') s++;\n            if (f == start.length() || s == end.length()) return s == end.length() && f == start.length();\n            char stChar = start.charAt(f);\n            char enChar = end.charAt(s);\n            if (stChar != enChar) return false;\n            if (stChar == \'R\' && f > s) return false;\n            if (stChar == \'L\' && f < s) return false;\n            f++;\n            s++;\n        }\n        return true;\n    }\n}\n```
['Two Pointers', 'Java']