Solving some hackerrank problems