Optimization Techniques
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach \n Describe your approach to solving the problem. \n\n# Complexity\n- Time
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach \n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n#include <vector>\n#include <string>\n#include <algorithm>\n#include"bits/stdc++.h"\n\nclass Solution {\n    int num(string s, vector<int>& mapping){\n        int x=0;\n        for(int i=0;i<s.size();i++){\n            x*=10;\n            int y= mapping[(s[i]-\'0\')];\n            x+= y;\n\n        }\n        return x;\n    }\npublic:\n    vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n        vector<pair<int, int>> v;\n\n        for (int i = 0; i < nums.size(); i++) {\n            string s = to_string(nums[i]);\n            int x=num(s, mapping);\n            cout<<x<<" ";\n            v.push_back({nums[i], x});\n\n            \n        }\n\n        stable_sort(v.begin(), v.end(), [](const auto& a, const auto& b) {\n            return a.second < b.second;\n        });\n\n        vector<int> ans;\n        for(int i = 0; i < v.size(); i++) {\n            ans.push_back(v[i].first);\n           \n        }\n       \n\n        return ans;\n    }\n};\n\n```
['Sorting', 'C++']