J.P. Morgan interview question

Question related to C++