Pregunta de entrevista de AMD

toughest work challenge and how i resolved it