#2481
Easy Algorithms Minimum cuts to divide a circle
Math Geometry
56.1% acceptance
Feb 25, 2026
321
63
A valid cut in a circle can be:
A cut represented by a straight line that touches two points on the edge and passes through its center, or
A cut that touches one point on the edge and the center.
Given n, return the minimum number of cuts needed to divide a circle into n equal slices.
Solution
Rust
Time O(1)
Space O(1)
impl Solution {
pub fn number_of_cuts(n: i32) -> i32 {
if n == 1 { 0 } else if n % 2 == 0 { n / 2 } else { n }
}
}