Simple Python code


  • 0
    A

    class Solution(object):
    def integerBreak(self, n):
    """
    :type n: int
    :rtype: int
    """
    prod = []
    for i in range(2,n+1):
    x = round(n/float(i))
    y = (x**(i-1) )* (n-x*(i-1))
    prod.append(int(y))

        return max(prod)

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.