← Morgan Stanley questions

Sort a second array based on the sorting order of a first array

Filed under Morgan Stanley

Given two arrays, sort the elements of the second array such that the relative order of elements matches that of the first array. Elements that do not appear in the first array should be placed at the…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Morgan Stanley questions

Collected from public candidate posts and coding forums. Updated Nov 2026.