Domanda di colloquio di Block

Regular CS and algorithm question. Nothing tricky.