Pregunta de entrevista de Google

Mathematical and coding questions. not unexpected.