Two pointers | O(len(target)) | Beginner Friendly
Intuition\n Describe your first thoughts on how to solve this problem. \nusing 2 pointers to check the conditions fro both strings\n\n# Approach\n Describe your
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nusing 2 pointers to check the conditions fro both strings\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- \'s\' pointer for start and \'t\' pointer for target\n- Take s to first letter ("L" or "R")\n- Take t to first letter (\'L\' or \'R\')\n- conditions for furthur loop:\n    1. if s exceeds the len(start) or t exceeds the len(target), then our solution is only true if both of them happen simulatenously. So condition is **s==len(start) and t==len(target)**\n    2. if start[s]!=target[t] break the loop\n    3. if start[s]==target[t]==\'L\' , s should be greater than t ( **s>=t** )\n    4. if start[s]==target[t]==\'R , r should be greater than s ( **t>=s** )\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def canChange(self, start: str, target: str) -> bool:\n        s,t=0,0\n        while s<len(start) or t<len(target):\n            while s<len(start) and start[s]==\'_\':\n                s+=1\n            while t<len(target) and target[t]==\'_\':\n                t+=1\n            if s==len(start) or t==len(target):\n                return (s==len(start) and t==len(target))\n            if (start[s]!=target[t] or (start[s]==\'L\' and s<t) or (start[s]==\'R\' and s>t)):\n                return False\n            s+=1\n            t+=1\n        return True\n```
['Two Pointers', 'String', 'Python3']