🔥🔥 [CPP] Easy Solution || Implementation
APPROACH\n\nOPTIONAL If you like the approach, make an upvote\nCan comment your approach and maximum optimisation possible.\n\n The question say if the values l
**APPROACH**\n\n*OPTIONAL If you like the approach, make an upvote\nCan comment your approach and maximum optimisation possible.*\n\n* The question say if the values like 1,2,3,4,5...get changes to as same as given in mapping,\n* Then on sorting what will be the sequence of nums array?\n* Firstly convery the 1_type_numbering to 2_type_numbering;\n* Sort the 2_type_numbering while keep track of indexes.\n* Take the values from 1_type_numbering through these tracked indexes.\n\n*Implementation-1*\n\n```\n    vector<int> ans;\n    vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n        int n=size(nums);\n        vector<pair<int,int>> t;\n        for(int i=0;i<n;i+=1){\n            int temp=nums[i];\n            string s="";\n            if(temp==0) s=to_string(mapping[0]);\n\t\t\t//if the number from nums is 0 that means it will be having lowest value in terms of mapping too.\n            while(temp) {\n                s=to_string(mapping[temp%10])+s;\n                temp/=10;\n            }\n\t\t\t// convering the 1_type_numbering to 2_type_numbering\n\t\t\t// can implement the number also but for me dealing with string is easy.\n            t.push_back({stoi(s),i});\n        }\n        sort(begin(t),end(t));\n        for(int i=0;i<size(t);i+=1) ans.push_back(nums[t[i].second]);\n        return ans;\n    }\n```\n\n*Implementation-2*\n\n```\n vector<int> ans;\n    vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n        \n        int n=size(nums);\n        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;\n        vector<pair<int,int>> t;\n        for(int i=0;i<n;i+=1){\n            int temp=nums[i];\n            string s="";\n            if(temp==0) s=to_string(mapping[0]);\n            while(temp) {\n                s=to_string(mapping[temp%10])+s;\n                temp/=10;\n            }\n            pq.push({stoi(s),i});\n        }\n        while(size(pq)){\n            ans.push_back(nums[pq.top().second]);\n            pq.pop();\n        } \n        return ans;\n```
['C', 'Heap (Priority Queue)']