C++ O(n) solution
Key observation is ab and a > b. No operation can swap (a,b). \n\nclass Solution {\npublic:\n    bool isTransformable(string s, string t) {\n        vector<dequ
Key observation is ab and a > b. No operation can swap (a,b). \n```\nclass Solution {\npublic:\n    bool isTransformable(string s, string t) {\n        vector<deque<int>> pos(10);\n        int p = 0;\n        for (char tt: t) {\n            int c = tt - \'0\';\n            while (p < s.length() && pos[c].size() == 0) {\n                pos[s[p]-\'0\'].push_back(p);\n                p++;\n            }\n            if (pos[c].empty()) return false;\n            for (int i = 0; i < c; i++) if (!pos[i].empty() && pos[i].front() < pos[c].front()) return false;\n            pos[c].pop_front();\n        }\n        return true;\n    }\n};\n```
[]