Solution of HackerRank problems