[c++] sorting with custom comparator
\nclass Solution {\npublic:\n    static bool cmp(pair<int,int>& a,pair<int,int>& b){\n        if(a.first==b.first) return a.second<b.second;\n        return a.f
```\nclass Solution {\npublic:\n    static bool cmp(pair<int,int>& a,pair<int,int>& b){\n        if(a.first==b.first) return a.second<b.second;\n        return a.first<b.first;\n    }\n    \n    vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n        vector<pair<int,int>> maped(nums.size());\n        for(int i=0;i<nums.size();i++){\n            int cur=nums[i],newnum=0; bool flag=false;\n            for(int j=9;j>=0;j--){\n                int digit=cur/pow(10,j);\n                if(!digit && !flag && j!=0) continue;\n                flag=true;\n                newnum+=(mapping[digit]*pow(10,j));\n                cur-=(digit*pow(10,j));\n            }\n            maped[i].first=newnum;\n            maped[i].second=i;\n        }\n        sort(maped.begin(),maped.end(),cmp);\n        vector<int> res(nums.size());\n        for(int i=0;i<maped.size();i++){\n            res[i]=nums[maped[i].second];\n        }\n        return res;\n    }\n};\n```
['C', 'Sorting', 'C++']