Pregunta de entrevista de Intel Corporation

two logic questions and one programing question.