Minimum Cuts to Divide a Circle

Closed-form — 0 for n=1, 1 for odd n, n/2 for even n (diameter cuts).

Easy
Time O(1) Space O(1)
LeetCode
2 min read
math geometry

Problem#

Return the minimum number of straight cuts needed to divide a circle into n equal slices.

Examples#

  • n=42 (two perpendicular diameters).
  • n=33; n=10.

Constraints#

  • 1 <= n <= 100.

Approach#

If n == 1, no cuts needed. Otherwise, each diameter cut produces 2 slices; a chord cut produces 1 (if it doesn’t pass through the center, two chord cuts can’t always combine cleanly). Diameters work iff n is even — n/2 of them. For odd n, each cut must be a separate non-diameter chord radiating from the center — n cuts.

Solution#

Minimum Cuts to Divide a Circle
class Solution {
public:
int numberOfCuts(int n) {
if (n == 1) return 0;
return (n % 2 == 0) ? n / 2 : n;
}
};

Editorial#

The only non-trivial observation: a single straight cut through the center produces 2 slices, but two cuts at different angles share the center, so 3 cuts give 6 slices, etc. — only even slice counts are achievable via diameters. For odd slice counts, all cuts must be radii (half-diameters) at different angles, hence one per slice.

Complexity#

  • Time: O(1).
  • Space: O(1).

Concept revision#

Search ESC

Keyboard shortcuts

Shortcuts are disabled while typing in inputs.