Interfaz interview question

Solve logical problems in code related to the position.