Greedy - Shift elements to left
\n# Code\n\nclass Solution {\npublic:\n    bool isTransformable(string s, string t) {\n        vector<vector<int>> indexes(10);\n        vector<int> pos(10, 0);
\n# Code\n```\nclass Solution {\npublic:\n    bool isTransformable(string s, string t) {\n        vector<vector<int>> indexes(10);\n        vector<int> pos(10, 0);\n        for(int i = 0; i < s.length(); i++) {\n            indexes[s[i] - \'0\'].push_back(i);\n        }\n\n        for(int i = 0; i < t.length(); i++) {\n            int digit = t[i] - \'0\';\n            \n            if(!indexes[digit].size()) {\n                return false;\n            }\n            \n            if (pos[digit] >= indexes[digit].size()) {\n                return false;\n            }\n\n            // check if it has any small characters in front of it.\n            for(int j = 0; j < digit; j++) {\n                if(pos[j] < indexes[j].size()&& indexes[j][pos[j]] < indexes[digit][pos[digit]]) {\n                    return false;\n                }\n            }\n            pos[digit]++;\n        }\n        return true;\n    }\n};\n\n```
['C++']