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
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- 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
- Minimize number of cuts required to break N length stick into N unit length sticks
- Probability that the pieces of a broken stick form a n sided polygon
- Probability of cutting a rope into three pieces such that the sides form a triangle
- 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
- Querying maximum number of divisors that a number in a given range has
- Find maximum number that can be formed using digits of a given number
- 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
- Number of subsets whose mean is maximum
- Maximum possible number with the given operation
- Maximum number of segments that can contain the given points
- Number of subarrays whose minimum and maximum are same
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.