Hackerrank Solution In Python