Pregunta de entrevista de IBM

Two coding problems on HackerRank. One was easy, one was difficult.