Pregunta de entrevista de Softwire

Pseudo- coding, very logic based