Solution of Hackerrank problems