Arm interview question

Problem solving, advanced C++