1585. Check If String Is Transformable With Substring Sort Operations.cpp
Code\n\nclass Solution {\npublic:\n    bool isTransformable(string s, string t) {\n        vector<vector<int>> pos(10);\n        for (int i = s.size() - 1; i >=
**Code**\n```\nclass Solution {\npublic:\n    bool isTransformable(string s, string t) {\n        vector<vector<int>> pos(10);\n        for (int i = s.size() - 1; i >= 0; i--) pos[s[i] - \'0\'].push_back(i);       \n        for (int i = 0; i < t.size(); i++) {\n            int d = t[i] - \'0\';           \n            if (!pos[d].size()) return false;\n            for (int j = 0; j < d; j++) {\n                if (pos[j].size() && pos[j].back() < pos[d].back()) return false;\n            }          \n            pos[d].pop_back();\n        }        \n        return true;\n    }\n};\n```
['C']