1317. Convert Integer to the Sum of Two No-Zero Integers

Intuition

The range of n is [2, 10 ^ 4]. So we could solve this problem simply by brute force.

Solution

class Solution:
    def getNoZeroIntegers(self, n: int) -> List[int]:
        for i in range(1, n):
            if '0' not in str(i) and '0' not in str(n - i):
                return [i, n - i]

Information

  • Created: 2020-01-12 16:02:23

  • Last Motified: 2020-01-12 16:02:23

  • Tags: Math