Practice Sort the Jumbled Numbers
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Map each decimal digit d of a nums entry to mapping[d] and interpret the resulting digits as an integer. Return the original entries sorted by these mapped values in nondecreasing order. Keep input order for equal mapped values and do not replace output entries by their mapped values.
Source: Sort the Jumbled Numbers on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
mapping = [8,9,4,0,2,1,3,5,7,6], nums = [991,338,38]
Output
[338,38,991]
# Example 2
Input
mapping = [0,1,2,3,4,5,6,7,8,9], nums = [789,456,123]
Output
[123,456,789]
Constraints
mapping.length == 10
0 <= mapping[i] <= 9
All the values of mapping[i] are unique.
1 <= nums.length <= 3 * 10^4
0 <= nums[i] < 10^9
Related LeetCode Problems
Practice more problems similar to Sort the Jumbled Numbers.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.