Solutions to hackerrank questions