4line Java solution very simple


  • 0
    S
    public int integerBreak(int n) {
      if (n==2 || n==3) return n-1;
      int res = 1;
      while (n>4) { n -= 3; res *= 3;}
      return res*n;
    }
    

Log in to reply
 

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