Back to problems

Sort Target String by Custom Order

Algorithm · Waymo · Medium

Requirements Inputs are target, the text whose characters must be reordered, and order, a permutation that specifies a nonstandard alphabet sequence. Return any rearrangement of target where, for every pair of characters x and y that both occur in order, x precedes y exactly when x precedes y within order. Any character from target that does not occur in order is allowed at any position in the returned string. Preparation Rehearse implementing the frequency-count-and-scan…

Checking your access…