I cannot sure the solution in c++ is right,though it is accepted


  • 0
    S
    int integerBreak(int n) 
    {
        int max=0;
        for(int i=2;i<=n;i++)
        {
            int j=n%i;
            int k=pow(n/i,i-j)*pow(n/i+1,j);
            if(k>max)max=k;
        }
        return max;
    }
    

    I can not prove it,so I just want to see if the solution is right


Log in to reply
 

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