0% completed
Given two arrays arr1
of length n
and arr2
of length m
, sort the elements of arr1
such that the relative ordering of items in arr1
is the same as in arr2
. Elements that do not appear in arr2
should be placed at the end of arr1
in ascending order.
It is given that elements of arr2
are distinct, and all elements in arr2
are also in arr1
.
arr2
are placed in arr1
first in the same order as in arr2
. The remaining elements 2 and 3 are placed at the end in ascending order.arr2
are placed in arr1
first in the same order as in arr2
. Remaining elements 1, 5 and 7 are placed at the end in ascending order.arr2
are placed in arr1
first in the same order as in arr2
. The remaining element 9 is placed at the end in ascending order.Constraints:
arr2
are distinct.arr2[i]
is in arr1
.Try solving this question here:
.....
.....
.....