Deque and position checking | Explained
We need to make the following checks for left and right ("L", "R")\n\n1. If there is a "R" between "L" actual position and it\'s final position -> return false 
We need to make the following checks for left and right ("L", "R")\n\n1. If there is a "R" between "L" actual position and it\'s final position -> `return false` since it can\'t be placed in the final location\n2. If the next "L" position is after the current index -> `return false` since we can move only left\n\nDo the same logic for the other side with "R"\n\n\n# Code\n```\nfrom collections import deque\n\nclass Solution:\n    def canChange(self, start: str, target: str) -> bool:\n        n = len(start)\n        \n        seen_left = deque([])\n        seen_right = deque([])\n        target_left = deque([])\n        target_right = deque([])\n        \n        for i in range(n):\n            if start[i] == "R": seen_right.append(i)\n            if start[i] == "L": seen_left.append(i)\n            if target[i] == "L": target_left.append(i)\n            if target[i] == "R": target_right.append(i)\n            \n        \n        for i in range(n):\n            if start[i] == "L":\n                if not target_left: return False\n                \n                next_left_target_index = target_left.popleft()\n                \n                if next_left_target_index > i:\n                    return False\n                \n                \n                # irrelevant\n                while seen_right and seen_right[0] < next_left_target_index:\n                    seen_right.popleft()\n                \n                # blocking between actual and target\n                if seen_right and next_left_target_index <= seen_right[0] <= i:\n                    return False\n            \n        for i in range(n):\n            cur_i = n-1-i\n            if start[cur_i] == "R":\n                if not target_right: return False\n                \n                next_right_target_index = target_right.pop()\n                \n                if next_right_target_index < cur_i:\n                    return False\n                \n                # irrelevant\n                while seen_left and seen_left[-1] > next_right_target_index:\n                    seen_left.pop()\n                \n                # blocking between actual and target\n                if seen_left and cur_i <= seen_left[-1] <= next_right_target_index:\n                    return False\n            \n        return len(target_left) == 0 and len(target_right) == 0\n\n```
['Queue', 'Python']