Each full cut adds two more regions. So, for even n’s we can use full cuts. For example, when n = 4, we have two full cuts which can be thought of as four aligned half-cuts. To go from n = 4 to n = 5, we need to adjust the angles between these four half-cuts to be able to introduce the fifth half-cut.

Time: , space:
.
class Solution:
def numberOfCuts(self, n: int) -> int:
if n == 1:
return 0
q, r = divmod(n, 2)
return q if r == 0 else n
Leave a comment