Morgan Stanley Interview Question

To solve a matrix searching problem and how to optimize it