Hackerrank Solution