Talentd
FleetCode
Make and follow sheets.Sign in

Minimum Cuts to Divide a Circle solution and explanation

EasyGeometryMath5 min read56.7% acceptanceUpdated 9 Apr 2026
2481. Minimum Cuts to Divide a Circle (Leetcode Easy)Programming Live with Larry · 5:59 · 393 viewsWatch on YouTube
9 more videos on this problem
  1. 2481. Minimum Cuts to Divide a Circle (Leetcode Easy)Programming Live with Larry · 5:59 · 393 views
  2. 6249. Minimum cuts to divide a circle | leetcode Biweekly Contest 92 solution.NeoAshish Wecan · 0:16 · 310 views
  3. Leetcode BiWeekly contest 92 - Easy - Minimum Cuts to Divide a CirclePrakhar Agrawal · 6:32 · 265 views
  4. Minimum Cuts to Divide a Circle - LeetCode 2481 - Python Solution Code Answer and ExplanationAlgoSkills · 7:33 · 246 views
  5. Minimum Cuts to Divide a Circle Leetcode SolutionCodeWithNoob · 0:47 · 238 views
  6. Leetcode 6249 || Minimum Cuts to Divide a Circle || Leetcode Contest EasyCoding Techniques with Komal | Newton School · 4:24 · 215 views
  7. Leetcode 2481: Minimum Cuts to Divide a CircleAlgorithms Casts · 6:49 · 127 views
  8. Math-6 | 2481. Minimum Cuts to Divide a Circle | 🔥 Beginner, Medium & Advanced LevelCTO Bhaiya · 4:40 · 117 views
  9. Leetcode 2481. Minimum Cuts to Divide a CircleElite Code · 5:08 · 104 views
  10. Leetcode 2481 Minimum Cuts to Divide a CircleMath Geeks · 2:02 · 94 views

The problem

A valid cut in a circle can be:

  • 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
  • A cut that is represented by a straight line that touches one point on the edge of the circle and its center.

Some valid and invalid cuts are shown in the figures below.

Given the integer n, return the minimum number of cuts needed to divide a circle into n equal slices.

Example 1:

Input: n = 4
Output: 2
Explanation: 
The above figure shows how cutting the circle twice through the middle divides it into 4 equal slices.

Example 2:

Input: n = 3
Output: 3
Explanation:
At least 3 cuts are needed to divide the circle into 3 equal slices. 
It can be shown that less than 3 cuts cannot result in 3 slices of equal size and shape.
Also note that the first cut will not divide the circle into distinct parts.

Constraints:

  • 1 <= n <= 100

Approach overview

Problem Overview: Given an integer n, determine the minimum number of straight cuts required to divide a circle into exactly n equal slices. Each cut is a straight line across the circle and can intersect previous cuts.

Approach 1: Iterative Simulation of Cuts (O(n) time, O(1) space)

This approach simulates the cutting process conceptually. Start from a single whole circle and reason about how many additional slices each new cut can produce. If you keep adding cuts one by one, you track the total pieces formed until reaching n. The logic relies on recognizing how a cut across the circle can create new regions depending on where it passes relative to previous cuts. While simple to reason about, this method still performs repeated checks or iterations up to n, making it less efficient than a direct formula.

The approach is useful for understanding the geometry behind the problem. It helps you visualize how slices increase as you add diameters or chords. However, since the relationship between cuts and slices follows a predictable pattern, simulation becomes unnecessary once the pattern is recognized.

Approach 2: Mathematical Calculation for Minimum Cuts (O(1) time, O(1) space)

The optimal solution comes from a simple geometric observation. If n == 1, no cuts are needed. When n is even, each cut can pass through the center (a diameter) and create two equal slices. With n/2 diameters, you get exactly n equal pieces. When n is odd, diameters alone cannot produce the required symmetry, so each slice requires its own cut, resulting in n cuts.

This reduces the problem to a constant-time formula: return 0 if n == 1, return n / 2 if n is even, otherwise return n. No loops, no data structures, and no geometric construction are required. The entire solution relies on recognizing the symmetry properties of circles and diameters.

The reasoning falls under basic Math and Geometry concepts, especially symmetry and equal partitioning of circular regions.

Recommended for interviews: The mathematical observation is what interviewers expect. It shows you can move from brute reasoning to pattern recognition and reduce the problem to an O(1) formula. Mentioning the simulation idea briefly demonstrates understanding of the geometry, but implementing the constant-time solution shows stronger problem-solving skill.

Approach 1: Mathematical Calculation for Minimum Cuts

When you have a circle, dividing it into n equal parts can be achieved depending on whether n is even or odd.

  • Even: When n is even, you can achieve this with n/2 cuts through the center because each cut through the center divides the circle into two equal parts.
  • Odd: When n is odd, each cut after the first one can pass through the center, adding one more section than the previous even count, so you must use n cuts.
def minCuts(n):
    return n // 2 if n % 2 == 0 else n
public class Main {
    public static int minCuts(int n) {
        return (n % 2 == 0) ? n / 2 : n;
    }

    public static void main(String[] args) {
        int n = 4;
        System.out.println(minCuts(n));
    }
}
#include <iostream>

int minCuts(int n) {
    return (n % 2 == 0) ? n / 2 : n;
}

int main() {
    int n = 3;
    std::cout << minCuts(n) << std::endl;
    return 0;
}
function minCuts(n) {
    return (n % 2 === 0) ? n / 2 : n;
}

console.log(minCuts(3));
#include <stdio.h>

int minCuts(int n) {
    return (n % 2 == 0) ? n / 2 : n;
}

int main() {
    int n = 4;
    printf("%d\n", minCuts(n));
    return 0;
}
using System;

public class Program {
    public static int MinCuts(int n) {
        return (n % 2 == 0) ? n / 2 : n;
    }

    public static void Main() {
        int n = 4;
        Console.WriteLine(MinCuts(n));
    }
}

In this Python solution, the key logic is whether n is even or odd. If n is even, dividing n by 2 gives the number of cuts needed. If n is odd, n cuts are required.

Complexity

The time complexity is O(1) since the calculations involved are basic arithmetic operations. The space complexity is also O(1) because no additional data structures are used.

Try this approach in the editor

Approach 2: Iterative Simulation of Cuts

This approach involves simulating the division by using iterations and manually counting the number of cuts. It covers each scenario by first considering it as a line that does not pass through the center of the circle, but subsequently confirms the equal division of the circle.

def minCutsIterative(n):
    if n == 1:
        return 0
    cuts = 1
    while (1 << cuts) - 1 < n:
        cuts += 1
    return cuts
public class MainIterative {
    public static int minCutsIterative(int n) {
        if (n == 1) return 0;
        int cuts = 1;
        while ((1 << cuts) - 1 < n) {
            cuts++;
        }
        return cuts;
    }

    public static void main(String[] args) {
        int n = 3;
        System.out.println(minCutsIterative(n));
    }
}
#include <iostream>

int minCutsIterative(int n) {
    if (n == 1) return 0;
    int cuts = 1;
    while ((1 << cuts) - 1 < n) {
        cuts++;
    }
    return cuts;
}

int main() {
    int n = 4;
    std::cout << minCutsIterative(n) << std::endl;
    return 0;
}
function minCutsIterative(n) {
    if (n === 1) return 0;
    let cuts = 1;
    while ((1 << cuts) - 1 < n) {
        cuts++;
    }
    return cuts;
}

console.log(minCutsIterative(3));
#include <stdio.h>
#include <math.h>

int minCutsIterative(int n) {
    if (n == 1) return 0;
    int cuts = 1;
    while ((1 << cuts) - 1 < n) {
        cuts++;
    }
    return cuts;
}

int main() {
    int n = 3;
    printf("%d\n", minCutsIterative(n));
    return 0;
}
using System;

public class ProgramIterative {
    public static int MinCutsIterative(int n) {
        if (n == 1) return 0;
        int cuts = 1;
        while ((1 << cuts) - 1 < n) {
            cuts++;
        }
        return cuts;
    }

    public static void Main() {
        int n = 4;
        Console.WriteLine(MinCutsIterative(n));
    }
}

Start with 1 cut and multiply by 2 each time after incrementing. Repeat until the number of distinct segments is no less than n.

Complexity

The while loop ensures that the computation quickly reaches a point , O(log n) time complexity and O(1) space complexity.

Try this approach in the editor

Approach 3: Case Discussion

  • When n=1, no cutting is needed, so the number of cuts is 0;
  • When n is odd, there is no collinear situation, and at least n cuts are needed;
  • When n is even, they can be collinear in pairs, and at least \frac{n}{2} cuts are needed.

In summary, we can get:

$ ans = \begin{cases} n, & n \gt 1 and n is odd \ \frac{n}{2}, & n is even \ \end{cases}

The time complexity is O(1), and the space complexity is O(1)$.

function numberOfCuts(n: number): number {
    return n > 1 && n & 1 ? n : n >> 1;
}
func numberOfCuts(n int) int {
	if n > 1 && n%2 == 1 {
		return n
	}
	return n >> 1
}
impl Solution {
    pub fn number_of_cuts(n: i32) -> i32 {
        if n > 1 && n % 2 == 1 {
            return n;
        }
        n >> 1
    }
}
Try this approach in the editor

Complexity comparison

ApproachComplexity
Mathematical Calculation for Minimum Cuts

The time complexity is O(1) since the calculations involved are basic arithmetic operations. The space complexity is also O(1) because no additional data structures are used.

Iterative Simulation of Cuts

The while loop ensures that the computation quickly reaches a point , O(log n) time complexity and O(1) space complexity.

Case Discussion–

Complexity analysis

ApproachTimeSpaceWhen to Use
Iterative Simulation of CutsO(n)O(1)Useful for understanding how slices grow with each cut or when deriving the mathematical pattern
Mathematical CalculationO(1)O(1)Best choice for interviews and production solutions due to constant-time computation

Frequently asked questions

Is Minimum Cuts to Divide a Circle easy or hard?

Minimum Cuts to Divide a Circle is classified as an Easy problem on LeetCode. The challenge is recognizing the mathematical pattern between the number of slices and the cuts required rather than implementing complex algorithms.

Minimum Cuts to Divide a Circle Python/Java solution

The implementation in Python, Java, C++, or JavaScript is very short. Check if n equals 1, return 0. If n is even return n/2, otherwise return n. Because the logic is constant time, the code typically fits within a few lines in any programming language.

How to solve Minimum Cuts to Divide a Circle in O(1)?

Check the value of n. If n equals 1, return 0. If n is even, return n/2 since each diameter cut produces two equal slices. If n is odd, return n because each slice effectively requires its own cut. This constant-time formula eliminates the need for simulation.

What is the best approach for Minimum Cuts to Divide a Circle?

The best approach is a mathematical observation that runs in O(1) time and O(1) space. If n equals 1, no cuts are needed. If n is even, n/2 diameter cuts create n equal slices. If n is odd, you need n cuts because diameters alone cannot produce an odd number of equal sections.

Is Minimum Cuts to Divide a Circle asked at Google/Amazon/Meta?

Problems based on mathematical observations and simple geometry frequently appear in coding interviews at companies like Google, Amazon, and Meta. While this exact problem may vary, recognizing patterns and reducing problems to O(1) formulas is a common interview expectation.

What data structure is used in Minimum Cuts to Divide a Circle?

No special data structure is required. The solution relies purely on mathematical reasoning and basic conditional checks, making it a Math and Geometry problem rather than a data structure problem.

What is the time complexity of Minimum Cuts to Divide a Circle?

The optimal solution runs in O(1) time and O(1) space because it uses a direct mathematical formula based on whether n is even or odd. No loops, recursion, or additional data structures are required.

Comments

Now write it yourselfClose this page and solve Minimum Cuts to Divide a Circle in the editor, without looking.
Practise Minimum Cuts to Divide a Circle