Pregunta de entrevista de PhysicsX

Hackerrank test. Questions fairly easy but need to work quickly.