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

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.