Best Solution.. By using custom compare lambda function..
Intuition\nJust thought about the mapping of the values.. with the corresponding keys in one map.. and indeces in the other map..\n\n# Approach\nSo, created a m
# Intuition\nJust thought about the mapping of the values.. with the corresponding keys in one map.. and indeces in the other map..\n\n# Approach\nSo, created a mapping using vector and pair and converted the values by using the given mapping vector and after that sorted that vector using custom compare lambda function.. and by using the index map for preserving the relative order of the same mapped values..\n\n# Complexity\n- Time complexity:\n- N(logN)\n\n- Space complexity:\n- O(2N)\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n        vector< pair<int, int> > mp;\n        unordered_map<int, int> index;\n\n        for(int i = 0; i < nums.size(); i++)\n        {\n            index[nums[i]] = i;\n            int val = nums[i];\n\n            int key = 0;\n            int j = 0;\n\n            if(val == 0)\n            {\n                key = mapping[val];\n            }\n            \n            while(val > 0)\n            {\n                int rem = val % 10;\n                key = key + (pow(10, j) * mapping[rem]);\n                j++;\n                val = val/10;\n            }\n\n\n            mp.push_back({key, nums[i]});\n        }\n\n        auto compare = [&] (auto a, auto b)\n        {\n            if(a.first == b.first)\n            {\n                return index[a.second] < index[b.second];\n            }\n            else if(a.first < b.first)\n            {\n                return a.first < b.first;\n            }\n            else return false;\n        };\n        sort(mp.begin(), mp.end(), compare);\n\n        for(int i = 0; i < mp.size(); i++)\n        {\n            nums[i] = mp[i].second;\n        }\n\n        return nums;\n    }\n};\n```
['C++']