Package g0301_0400.s0343_integer_break
Class Solution
java.lang.Object
g0301_0400.s0343_integer_break.Solution
343 - Integer Break.<p>Medium</p>
<p>Given an integer <code>n</code>, break it into the sum of <code>k</code> <strong>positive integers</strong> , where <code>k >= 2</code>, and maximize the product of those integers.</p>
<p>Return <em>the maximum product you can get</em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> n = 2</p>
<p><strong>Output:</strong> 1</p>
<p><strong>Explanation:</strong> 2 = 1 + 1, 1 × 1 = 1.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> n = 10</p>
<p><strong>Output:</strong> 36</p>
<p><strong>Explanation:</strong> 10 = 3 + 3 + 4, 3 × 3 × 4 = 36.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>2 <= n <= 58</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
integerBreak
public int integerBreak(int n)
-