you give 0indexed integer array mapping represent mapping rule shuffle decimal system mappingi j mean digit map digit j systemthe map value integer new integer obtain replace occurrence digit integer mappingi 0 9you give integer array num Return array num sort nondecrease order base map value elementsnoteselement map value appear relative order inputThe element num sort base map value replace Example 1input mapping 8940213576 num 99133838output 33838991explanation Map number 991 follows1 mapping9 6 occurrence digit 9 62 mapping1 9 occurrence digit 1 9Therefore map value 991 669338 map 007 7 remove lead zeros38 map 07 7 remove lead zerosSince 338 38 share map value remain relative order 338 come 38thus sort array 33838991example 2input mapping 0123456789 num 789456123output 123456789explanation 789 map 789 456 map 456 123 map 123 thus sort array 123456789 Constraintsmappinglength 100 mappingi 9all value mappingi unique1 numslength 3 1040 numsi 109