1122. Relative Sort Array #217
Unanswered
mah-shamim
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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
.Beta Was this translation helpful? Give feedback.
All reactions