2481. Minimum Cuts to Divide a Circle Easy
1/**
2 * [2481] Minimum Cuts to Divide a Circle
3 *
4 * A valid cut in a circle can be:
5 *
6 * 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
7 * A cut that is represented by a straight line that touches one point on the edge of the circle and its center.
8 *
9 * Some valid and invalid cuts are shown in the figures below.
10 * <img alt="" src="https://assets.leetcode.com/uploads/2022/10/29/alldrawio.png" style="width: 450px; height: 174px;" />
11 * Given the integer n, return the minimum number of cuts needed to divide a circle into n equal slices.
12 *
13 * <strong class="example">Example 1:
14 * <img alt="" src="https://assets.leetcode.com/uploads/2022/10/24/11drawio.png" style="width: 200px; height: 200px;" />
15 * Input: n = 4
16 * Output: 2
17 * Explanation:
18 * The above figure shows how cutting the circle twice through the middle divides it into 4 equal slices.
19 *
20 * <strong class="example">Example 2:
21 * <img alt="" src="https://assets.leetcode.com/uploads/2022/10/24/22drawio.png" style="width: 200px; height: 201px;" />
22 * Input: n = 3
23 * Output: 3
24 * Explanation:
25 * At least 3 cuts are needed to divide the circle into 3 equal slices.
26 * It can be shown that less than 3 cuts cannot result in 3 slices of equal size and shape.
27 * Also note that the first cut will not divide the circle into distinct parts.
28 *
29 *
30 * Constraints:
31 *
32 * 1 <= n <= 100
33 *
34 */
35pub struct Solution {}
36
37// problem: https://leetcode.com/problems/minimum-cuts-to-divide-a-circle/
38// discuss: https://leetcode.com/problems/minimum-cuts-to-divide-a-circle/discuss/?currentPage=1&orderBy=most_votes&query=
39
40// submission codes start here
41
42impl Solution {
43 pub fn number_of_cuts(n: i32) -> i32 {
44 0
45 }
46}
47
48// submission codes end
49
50#[cfg(test)]
51mod tests {
52 use super::*;
53
54 #[test]
55 fn test_2481() {
56 }
57}
58
Back
© 2025 bowen.ge All Rights Reserved.