Simple and straightforward solution | Sorting | C++
Intuition\nWe will have to map the mapped positions to the indices of the original nums vector and then sort them.\n\n# Approach\n1. Map the individual digits t
# Intuition\nWe will have to map the mapped positions to the indices of the original nums vector and then sort them.\n\n# Approach\n1. Map the individual digits to the mapping digits.\n2. Create a hash table of the mapped digits with the indices of nums, and not the actual nums, so that the original order is preserved after sorting.\n3. Sort the keys in the hash table.\n4. Append the num at the new position from the sorted hash table to the ans vector.\n\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n        const int m = nums.size();\n        vector<pair<int,int>> mpp;\n        vector<int> ans;\n        for(int i=0;i<m;++i){\n            int temp = nums[i];\n            if(temp==0){mpp.push_back({mapping[0],i});continue;}\n            int mapped = 0;\n            int mul = 1;\n            while(temp>0){\n                mapped+=(mapping[(temp%10)]*mul);\n                mul*=10;\n                temp/=10;\n            }\n            mpp.push_back({mapped,i});\n        }\n        sort(mpp.begin(),mpp.end());\n        for(int i=0;i<m;++i){ans.push_back(nums[mpp[i].second]);}\n        return ans;\n    }\n};\n```\n\nPlease upvote if you found it useful!!
['Array', 'Hash Table', 'Sorting', 'C++']