Pregunta de entrevista de Student Beans

How to solve a coding challenge