Lohika interview question

C++ problem solving in real time