Search
⌘K

Leetcode 1122. Relative Sort Array

Reorder arr1 so its elements follow the relative order given by arr2 (keeping duplicates together), and place elements not in arr2 at the end in ascending order. Typically solved by counting frequencies (or a hash map) to emit elements in arr2 order then output remaining values sorted.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.