Sort pairs (mapping(x), index) || Beats 100% ||  C++✔️
\n# Complexity\n- Time complexity: O (n log n )\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O (n)\n  Add your space complexity here, e.g.
\n# Complexity\n- Time complexity: O (n log n )\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O (n)\n <!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\nprivate:\n    int getNum(int num, vector<int>& mapping) {\n        if (num < 10) {\n            return mapping[num];\n        }\n        int mapNum = 0;\n        int placeValue = 1;\n        while (num > 0) {\n            int lastDigit = num % 10;\n            int mappedDigit = mapping[lastDigit];\n            mapNum += (mappedDigit * placeValue);\n            placeValue *= 10;\n            num /= 10;\n        }\n        return mapNum;\n    }\n\npublic:\n    vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n        int n = nums.size();\n        vector<pair<int, int>> vec;\n        for (int i = 0; i < n; i++) {\n            int mappedNum = getNum(nums[i], mapping);\n            vec.push_back({mappedNum, i});\n        }\n        sort(vec.begin(), vec.end());\n        vector<int> res;\n        for (auto it : vec) {\n            auto idx = it.second;\n            res.push_back(nums[idx]);\n        }\n        return res;\n    }\n};\n\n```
['C++']