solutions to some hacker rank problems