Solutions to Hacker Rank problems