HackerRank - Algorithms questions