Leetcode 1440 Solution

This article provides solution to leetcode question 1440 (convert-integer-to-the-sum-of-two-no-zero-integers)

https://leetcode.com/problems/convert-integer-to-the-sum-of-two-no-zero-integers

Solution

class Solution:
    def isNonZeroNumber(self, x):
        while x:
            if x % 10 == 0:
                return False
            x = x // 10
        return True

    def getNoZeroIntegers(self, n: int) -> List[int]:
        for i in range(1, n):
            if self.isNonZeroNumber(i) and self.isNonZeroNumber(n - i):
                return [i, n - i]