1122. Relative Sort Array #218
Labels
easy
Difficulty
hacktoberfest-accepted
hacktoberfest accepted
question
Further information is requested
Discussed in #217
Originally posted by mah-shamim August 2, 2024
Given two arrays
arr1
andarr2
, the elements ofarr2
are distinct, and all elements inarr2
are also inarr1
.Sort the elements of
arr1
such that the relative ordering of items inarr1
are the same as inarr2
. Elements that do not appear inarr2
should be placed at the end ofarr1
in ascending order.Example 1:
Example 2:
Constraints:
1 <= arr1.length, arr2.length <= 1000
0 <= arr1[i], arr2[i] <= 1000
arr2
are distinct.arr2[i]
is inarr1
.The text was updated successfully, but these errors were encountered: