Hacker Rank Problem solutions in python