← Morgan Stanley questions

Sort array B according to array A

Filed under Morgan Stanley

Given two arrays A and B, sort array B such that the relative order of elements in B follows the order of elements in A. Elements not present in A should be appended to the end of B in sorted order.

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.