Exercises from hackerrank.com