Custom Sort String(math)
S
andT
are strings composed of lowercase letters. InS
, no letter occurs more than once.
S
was sorted in some custom order previously. We want to permute the characters ofT
so that they match the order thatS
was sorted. More specifically, ifx
occurs beforey
inS
, thenx
should occur beforey
in the returned string.
Return any permutation ofT
(as a string) that satisfies this property.
Note:
分析
算出来T里每个char的count
先遍历S输出所有 [i*count[i]] 然后把T剩下的输出,还是[i*count[i]]
Last updated