Problem · Math
Minimum Cake Cuts
Learn this problemProblem statement
You have cakes identical whole cakes and people people. Divide all of the cake equally so that every person receives exactly the same total amount.
A cut divides one existing cake piece into two pieces. Whole cakes and cut pieces may be distributed independently, and one person may receive multiple pieces.
Return the minimum number of cuts required.
Function
minimumCakeCuts(cakes: int, people: int) → intExamples
Example 1
cakes = 2people = 6return = 4Each person must receive one third of a cake. Cutting each cake into three equal pieces takes two cuts per cake, for 4 cuts total.
Example 2
cakes = 3people = 2return = 1Give each person one whole cake, cut the remaining cake in half, and give one half to each person.
Constraints
1 <= cakes <= 10^31 <= people <= 10^3