Morgan Stanley interview question

C++ algorithm and OOP questions