Pergunta de entrevista da empresa Qualcomm

Mostly about C/C++ programming, some puzzles