Pregunta de entrevista de Consilience Software

Two algorithm/data-structure programming questions.