Class Solution
java.lang.Object
g2401_2500.s2481_minimum_cuts_to_divide_a_circle.Solution
2481 - Minimum Cuts to Divide a Circle.<p>Easy</p>
<p>A <strong>valid cut</strong> in a circle can be:</p>
<ul>
<li>A cut that is represented by a straight line that touches two points on the edge of the circle and passes through its center, or</li>
<li>A cut that is represented by a straight line that touches one point on the edge of the circle and its center.</li>
</ul>
<p>Some valid and invalid cuts are shown in the figures below.</p>
<p><img src="https://assets.leetcode.com/uploads/2022/10/29/alldrawio.png" alt="" /></p>
<p>Given the integer <code>n</code>, return <em>the <strong>minimum</strong> number of cuts needed to divide a circle into</em> <code>n</code> <em>equal slices</em>.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2022/10/24/11drawio.png" alt="" /></p>
<p><strong>Input:</strong> n = 4</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong> The above figure shows how cutting the circle twice through the middle divides it into 4 equal slices.</p>
<p><strong>Example 2:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2022/10/24/22drawio.png" alt="" /></p>
<p><strong>Input:</strong> n = 3</p>
<p><strong>Output:</strong> 3</p>
<p><strong>Explanation:</strong></p>
<p>At least 3 cuts are needed to divide the circle into 3 equal slices.</p>
<p>It can be shown that less than 3 cuts cannot result in 3 slices of equal size and shape.</p>
<p>Also note that the first cut will not divide the circle into distinct parts.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= n <= 100</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
numberOfCuts
public int numberOfCuts(int n)
-