Pregunta de entrevista de Whatnot

Coding question on internal problem