Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Custom Sort String

Given an order string with unique letters and a string s, permute s so that its letters appear in the order defined by order. Letters of s that are not in order go at the end in their original relative order.

Constraints

1 <= len(order), len(s) <= 200

Discussion

No discussions yet.

Rewards · v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.