Python O(10*n) using queue
Idea:\ns="xxxxAxxxx" t="Axxxxxxxx"\nTo move A to the most left, the best way is moving A one by one, it requires all the char on the left of A must be greater t
Idea:\ns="xxxxAxxxx" t="Axxxxxxxx"\nTo move A to the most left, the best way is moving A one by one, it requires all the char on the left of A must be greater than A.\nAfter that question becomes convert s[1:] to t[1:]\n\n Use queues to memorise all the position of 1...10 in s. Iterate chracter in T from left to right and\nSay A=t[0], then all the number smaller than A  in S must not be in the left of A\nIf it\'s true remove it in the queue of A and go to next character in T.\n```Python\nimport collections\n\nclass Solution:\n    def isTransformable(self, s: str, t: str) -> bool:\n        s=list([int(ch)for ch in s])\n        t=list([int(ch)for ch in t])\n        counter_s=collections.Counter(s)\n        counter_t=collections.Counter(t)\n        if counter_s!=counter_t:\n            return False\n\n        q_s=collections.defaultdict(collections.deque)\n        for i,x in enumerate(s):\n            q_s[x].append(i)\n        # print(q_s)\n        for x in t:\n            indx=q_s[x].popleft()\n            for i in range(x):\n                if q_s[i] and q_s[i][0]<indx:\n                    return False\n\n        return True\n
[]