🙀Beats 97.84% ✅✅ with Proof (Screenshot) 🙀| C++ beginner friendly 😊🙌
Intuition\n\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- Tim
# Intuition\n![day 24.png](https://assets.leetcode.com/users/images/d69a8519-da9e-4015-97f2-f94fad43b33f_1721794139.7308726.png)\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- O(n\u2217k+nlogn) - n is length of nums, k is the number of digits in a number\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n- O(n\u2217k) - n for auxiliary arrays and n*k for recursive call stack over each element\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int makeNum(int n, vector<int> & mapping) {\n        if (n == 0) return 0;\n        return (mapping[n % 10]) + makeNum(n / 10, mapping) * 10;\n    }\n    vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n        vector<int> ans;\n        vector<pair<int, int>> vec;\n\n        for (int i = 0; i < nums.size(); i++) {\n            if (nums[i] == 0) {\n                vec.push_back({mapping[nums[i]], i});\n            } else {\n                vec.push_back({makeNum(nums[i], mapping), i});\n            }\n        }\n\n        sort(vec.begin(), vec.end());\n\n        for (const auto & [num, i] : vec) {\n            ans.push_back(nums[i]);\n        }\n        return ans;\n    }\n};\n```
['C++']