Java || 26ms || Radix sort for speed
The code below uses a radix sort for faster speed.  The nums[] array is sorted multiple times to create the final sort.  Each sort pass sorts by a single digit 
The code below uses a **radix sort** for faster speed.  The `nums[]` array is sorted multiple times to create the final sort.  Each sort pass sorts by a single digit position, from least significant digit to the most significant digit.  First sort all `nums[]` values by the 1\'s place digits.  Then re-sort the `nums[]` values by the 10\'s place digits.  Then re-re-sort the `nums[]` values by the 100\'s place digits.  And so on, until sorting by the highest used digit position in the `nums[]` values.  See wikipedia for a more detailed explanation of radix sort.\n\n**--- Java clean code ---**\nRuntime is 26ms to 27ms in July 2024.\n```\nclass Solution {\n    public int[] sortJumbled(int[] mapping, int[] nums) {\n        int n = nums.length;\n        if (n <= 1)  return nums;\n\n        int maxNum = 1;\n        for (int num : nums)  if (num > maxNum)  maxNum = num;\n        \n        int[] result = new int[n];\n        int[] digit = new int[n];\n        for (int pow10 = 1; pow10 <= maxNum; pow10*= 10) {\n            final int testPow10 = (pow10 == 1) ? 0 : pow10;\n            int[] freq = new int[10];\n            for (int i = n - 1; i >= 0; i--) \n                freq[digit[i] = ((nums[i] < testPow10) ? 0 : mapping[(nums[i] / pow10) % 10])]++;\n            \n            for (int i = 1; i < 10; i++)\n                freq[i] += freq[i - 1];\n            \n            for (int i = n - 1; i >= 0; i--)\n                result[--freq[digit[i]]] = nums[i];\n\n            int[] tmpResult = result;\n            result = nums;\n            nums = tmpResult;\n        }\n        return nums;\n    }\n}\n```\n**--- Java commented code ---**\n```\nclass Solution {\n    public int[] sortJumbled(int[] mapping, int[] nums) {\n        int n = nums.length;\n        if (n <= 1)  return nums;\n\n        // Find the max value in nums[].\n        int maxNum = 1;\n        for (int num : nums)  if (num > maxNum)  maxNum = num;\n        \n        // Do radix sort from least significant decimal digit \n        // in nums[] values, to most significant decimal degit \n        // in nums[] values.  The pow10 loop is the power of 10 \n        // for the current digit position (1, 10, 100...) of \n        // the radix sort.\n        int[] result = new int[n];\n        int[] digit = new int[n];\n        for (int pow10 = 1; pow10 <= maxNum; pow10*= 10) {\n            // Get the frequency (i.e. counts) of the current \n            // digit from all of the nums[] values.\n            final int testPow10 = (pow10 == 1) ? 0 : pow10;\n            int[] freq = new int[10];\n            for (int i = n - 1; i >= 0; i--) \n                freq[digit[i] = ((nums[i] < testPow10) ? 0 : mapping[(nums[i] / pow10) % 10])]++;\n            \n            // Convert the frequency counts to the index an index \n            // into result[] array, just past the area in result[] \n            // where nums[] values with that digit in current digit \n            // position will be stored in result[].  i.e. nums[] \n            // values with "0" in the current digit position, will \n            // be stored in result[0..freq[0]-1], and nums[] values \n            // with "1" in the current digit position, will be \n            // stored in result[freq[0]..freq[1]-1], and so on for \n            // higher digits.\n            for (int i = 1; i < 10; i++)\n                freq[i] += freq[i - 1];\n            \n            // Copy nums[] values into the area of result for their \n            // digit in the current digit position.  This loop MUST \n            // be done from end of nums[] back to the beginning, \n            // because the freq[digit] value is the index PAST the \n            // end of that digit\'s area in result[].  This loop \n            // decrements the freq[digit] values to fill the digit\'s \n            // area of result[] array from end of that area back \n            // to start of that area.\n            for (int i = n - 1; i >= 0; i--)\n                result[--freq[digit[i]]] = nums[i];\n\n            // The result[] array was just filled with nums[] values \n            // that were sorted on the digit in the current digit \n            // position.  Now swap nums[] and result[] arrays so that \n            // the radix sort can loop back and re-fill result[] from \n            // a modified nums[] array that is based on the sorted \n            // results from all lower digit positions.\n            int[] tmpResult = result;\n            result = nums;\n            nums = tmpResult;\n        }\n        \n        return nums;\n    }\n}\n```\n
['Java']