Leetcode 1366 Python Algorithm To Convert