0ms cpp Solution


  • 0
    G
    class Solution {
    public:
    int integerBreak(int n) {
        if(n<4) return n-1;
        if(n==4) return 4;
        if(n>4){
            if(n%3==1) return pow(3,n/3-1)*4;
            if(n%3==0) return pow(3,n/3);
            if(n%3==2) return pow(3,n/3)*(n%3);
        }
    }
    };

Log in to reply
 

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