O(n^2) check anagrams, check position of  nums(0...9) must be greater in s than in t.
\nclass Solution {\npublic:\n    bool isTransformable(string s, string t) {\n        if(s==t) return true;\n        if(issorted(s)) return false;\n        int n
```\nclass Solution {\npublic:\n    bool isTransformable(string s, string t) {\n        if(s==t) return true;\n        if(issorted(s)) return false;\n        int n=s.size();\n        for(char ch=\'0\'; ch<=\'9\'; ch++) {\n            string sn,tn;\n            vector<int> sv,tv;\n            sn=tn="";\n              for(int i=0; i<s.size(); i++) {\n                  if(s[i]==ch) sv.push_back(i);\n                  if(t[i]==ch) tv.push_back(i);\n              }\n              if(sv.size()!=tv.size()) return false; /* has to be an anagram */\n              for(int i=0; i<sv.size(); i++) if(sv[i]<tv[i]) return false; \n              /* position of min character in s is less than t , it can never be sorted */\n              \n              for(int i=0; i<s.size(); i++) {\n                    if(s[i]>ch) sn.push_back(s[i]);   /* remove the current char along the way */\n                    if(t[i]>ch) tn.push_back(t[i]);\n              }\n              s=sn;\n              t=tn;\n        }   \n        return true;\n    }\n    bool issorted(string a) {\n        for(int i=0; i<a.size()-1; i++) {\n             if((int)a[i]>(int)a[i+1]) return false;\n        }\n        return true;\n    }\n};\n\n\n\n/*\n\n2 3 4 1 5\n    \n3 4 5 2 1\n\n---------\n    \n3 4 8 5 2\n    \n8 4 3 5 2\n    \n3 4 8 5 2\n\n*/\n\n\n    \n    \n     \n```
[]