Given a square piece and a total number of cuts available n, Find out the maximum number of rectangular or square pieces of equal size that can be obtained with n cuts. The allowed cuts are horizontal and vertical cut.
Note: Stacking and folding is not allowed.
Input : n = 1 Output : 2 Explanation : Input : n = 2 Output : 4 Explanation : Input : n = 3 Output : 6 Explanation :
Given is n which is the number of allowed cuts. As it is required to maximize number of pieces after n cuts, So number of horizontal cuts will be equal to number of vertical cuts. This can be prove using differentiation. So number of horizontal cut will be n/2. and vertical cuts will be n-n/2.
So number of pieces = (horizontal cut + 1) * (vertical cut + 1).
Max number of pieces for n = 3 is 6
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Count pieces of circle after N cuts
- Possible cuts of a number such that maximum parts are divisible by 3
- Minimum number of cuts required to pay salary from N length Gold Bar
- Minimum number of cuts required to make circle segments equal sized
- Number of ways to cut a stick of length N into in even length at most K units long pieces
- Minimize number of cuts required to break N length stick into N unit length sticks
- Probability of cutting a rope into three pieces such that the sides form a triangle
- Probability that the pieces of a broken stick form a n sided polygon
- Minimum Cuts can be made in the Chessboard such that it is not divided into 2 parts
- Minimum cuts required to divide the Circle into equal parts
- Find the largest number smaller than integer N with maximum number of set bits
- Largest number dividing maximum number of elements in the array
- Find maximum number that can be formed using digits of a given number
- Querying maximum number of divisors that a number in a given range has
- Find the maximum number of composite summands of a number
- Represent a number as a sum of maximum possible number of Prime Numbers
- Number with maximum number of prime factors
- Maximum possible number with the given operation
- Number of subsets whose mean is maximum
- Find M such that GCD of M and given number N is maximum
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.