Siemens Interview Question

Very basic C++ and algorithm question