C++ O(N) Time & O(1) Space
\nclass Solution {\npublic:\n    bool canChange(string start, string target) {\n        int L=0,R=0;\n        for(int i=0;i<start.size();i++)\n        {\n      
```\nclass Solution {\npublic:\n    bool canChange(string start, string target) {\n        int L=0,R=0;\n        for(int i=0;i<start.size();i++)\n        {\n            if(start[i]==\'R\')\n            {\n                if(L!=0 || R<0) return false;\n                R++;\n            }\n            \n            if(target[i]==\'R\')\n            {\n                if(L!=0 || R<=0) return false;\n                R--;\n            }\n            else if(target[i]==\'L\')\n            {\n                if(R!=0 || L<0) return false;\n                L++;\n            }\n            \n            if(start[i]==\'L\')\n            {\n                if(R!=0 || L<=0) return false;\n                L--;\n            }\n        }\n        return (R==0 && L==0);\n    }\n};\n```
[]