HackerRank changes' python solution