Pregunta de entrevista de Two Sigma

Two intermediate level C++ programming problems.