Easy · Strings
Custom Sort String
Given order, a string of distinct lowercase letters, and a lowercase string s, return any permutation of s in which, whenever x comes before y in order, every x appears before every y; letters that order does not contain may be placed anywhere.
Examples
Example 1
order="cba", s="abcd"Output: "cbad"
Example 2
order="bcafg", s="abcd"Output: "bcad"
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.