Solutions for Hacker Rank problems