[ C++ ] -> Customized Sort | Memory Beats 96%
Complexity\n- Time complexity: O(nlog(n))\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n
# Complexity\n- Time complexity: $$O(nlog(n))$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    int convert(vector<int> &mp, int num) {\n        if (num < 10) {\n            return mp[num];\n        }\n        \n        int new_num = 0;\n        int base = 1;\n        while (num) {\n            int new_digit = mp[num % 10];\n            new_num += new_digit * base;\n            num /= 10;\n            base *= 10;\n        }\n        return new_num;\n    }\n\npublic:\n    vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {\n        sort(nums.begin(), nums.end(), [&mapping, this](const int &a, const int &b) {\n            int first = this->convert(mapping, a);\n            int second = this->convert(mapping, b);\n            return first < second;\n        });\n\n        return nums;\n    }\n};\n```
['C++']