Pregunta de entrevista de Fidessa

2 fairly easy algorithm questions.