C++ | Loop Left & Right ~ O(N)
Track Position Together Solution (Inspired from @IAmCoderrr)\ncpp\nbool canChange(string start, string target) {\n    int i = 0, j = 0, n = start.size();\n\t\n\
1. **Track Position Together Solution** (Inspired from [@IAmCoderrr](https://leetcode.com/IAmCoderrr))\n```cpp\nbool canChange(string start, string target) {\n    int i = 0, j = 0, n = start.size();\n\t\n\t// we keep OR condition to execute the loop one more time till remaining \'_\' present\n    while(i < n || j < n){\n        while(i < n && start[i] == \'_\') i++;\n        while(j < n && target[j] == \'_\') j++;\n\n\t\t// if all chars are \'_\', break\n        if(i == n || j == n) break;\n\n        if(start[i] != target[j]) return false;\n\t\t\n\t\t//positional conditions\n        if(start[i] == \'L\') if(i < j) return false;\n        if(start[i] == \'R\') if(i > j) return false;\n        i++; j++;\n    }\n\n    return i == n && j == n;\n}\n```\n\n2. **Two Loop Solution** - Keeps making char changes live.\n```cpp\nbool canChange(string start, string target) {\n    unordered_map<char, int> chars1, chars2;\n    for(char& ch: start)\n        chars1[ch]++;\n    for(char& ch: target)\n        chars2[ch]++;\n\n    if(chars1 != chars2) return false;\n\n    int n = start.size();\n\n    //move from right to left for \'R\' changes\n    for(int i=n-1; i >= 0; i--){\n        if(start[i] == target[i]) continue;\n\n        char req = target[i];\n        if(req == \'R\'){\n            int j = i;\n            while(j >= 0 && start[j] == \'_\'){\n                start[j] = target[j];\n                j--;\n            }\n            if(j < 0 || start[j] == \'L\') return false;\n            start[j] = \'_\';\n            i = j + 1;\n        }\n    }\n\n    //move from left to right for \'L\' changes\n    for(int i=0; i < n; i++){\n        if(start[i] == target[i]) continue;\n\n        char req = target[i];\n        if(req == \'L\'){\n            int j = i;\n            while(j < n && start[j] == \'_\'){\n                start[j] = target[j];\n                j++;\n            }\n            if(j == n || start[j] == \'R\') return false;\n            start[j] = \'_\';\n            i = j - 1;\n        }\n    }\n    return true;\n}\n```\n
['C']