Solving Relative Sort Array in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

Example 1:

Input: arr1 = [2,3,1,3,2,4,6,7,9,2,19], arr2 = [2,1,4,3,9,6]
Output: [2,2,2,1,4,3,3,9,6,7,19]

Constraints:

  • arr1.length, arr2.length <= 1000

  • 0 <= arr1[i], arr2[i] <= 1000

  • arr1.length, arr2.length <= 1000

  • 0 <= arr1[i], arr2[i] <= 1000

See the full details of the problem Relative Sort Array at LeetCode

Originally posted at: @github.com/halfrost/LeetCode-Go