Leetcode 399 Python Algorithm To Convert