306. Additive Number

import itertools
class Solution(object):
    def isAdditiveNumber(self, num):
        """
        :type num: str
        :rtype: bool
        """
        n=len(num)
        for i,j in itertools.combinations(range(1,n),2):
            a,b=num[:i],num[i:j]
            if b!=str(int(b)) or a!=str(int(a)):
                continue
            
            while j

你可能感兴趣的:(306. Additive Number)