Qualcomm Interview Question

Some coding question in C++