C++ Comparator | Detailed | Easy to understand
cpp\nclass Solution {\n    long long mappedValue(int original, vector<int>& mapping) {\n        string number = to_string(original);\n        int N = number.len
```cpp\nclass Solution {\n    long long mappedValue(int original, vector<int>& mapping) {\n        string number = to_string(original);\n        int N = number.length();\n        for(int i = 0; i < N; i++) {\n            number[i] = mapping[number[i] - \'0\'] + \'0\';\n        }\n\t\t// The mapped value may get out of range in integers. So prefer long long for safety.\n        long long answer = std::stoll(number);\n        return answer;\n    }\n    \npublic:\n    vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n        vector<pair<long long, int>> newArray;\n        int N = nums.size();\n        for(int i = 0; i < N; i++) {\n            newArray.push_back({mappedValue(nums[i], mapping), nums[i]});\n        }\n\t\t// Here sorting is done based on mapped values.\n        sort(newArray.begin(), newArray.end(), [&](const pair<long long, int> &p1, const pair<long long, int> &p2){\n            return p1.first < p2.first;\n        });\n\t\t\n        \n        vector<int> answer;\n        // Here in sorted vector, we are adding the original values given in nums vector\n        for(auto a : newArray) {\n            answer.push_back(a.second);\n        }\n        return answer;\n    }\n};\n```
['C']