One Pointer | Time O(n) | Space O(1)
One Pointer | Time O(n) | Space O(1)\n\n# Code\ncpp []\nclass Solution {\npublic:\n    bool canChange(string start, string target) {\n        int n = start.leng
## One Pointer | Time O(n) | Space O(1)\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    bool canChange(string start, string target) {\n        int n = start.length();\n        int l=0, r=0;\n        for(int i=0; i<n; i++){\n            if(start[i] == \'L\'){\n                l--;\n            }\n            else if(start[i] == \'R\'){\n                r++;\n                if(l!=0) return false;\n            }\n            if(target[i] == \'L\'){\n                l++;\n                if(r!=0) return false;\n            }\n            else if(target[i] == \'R\'){\n                r--;\n            }\n\n            if(l<0 || r<0) return false;\n        }\n        return l==0 && r==0;\n    }\n};\n```
['C++']