Pregunta de entrevista de Book Systems

A logic question and a programming question.