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

Relative Sort Array

Sort arr1 so that elements appear in the order of arr2 (all arr2 elements are in arr1); elements not in arr2 are placed at the end in ascending order.

Constraints

1 <= m <= n <= 1000

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.