master_pizza_slicer (retired)
Description:
I'm having a pizza party with a bunch of friends. Unfortunately, I only made two pizzes--one square and one circular. However, I am amazingly gifted at cutting pizzes. I am going to give everyone an equal slice of each pie. By equal, it has the same 2D shape--forget about the fact that the crust is higher than other parts of the pizza. The rules I follow for cutting pizzas are fairly standard. I can't fold or twist the pizza--I'm not making calzones. I can't lay one pie on top of the other--my guests loath a greasy bottom. The pizzas remain one layer high on my pizza-cutting table. I can start and finish a cut anywhere i want. For example, if I wanted to make three equal slices of a circular pizza, I would cut three straight lines from the crust to the center. There may be some extra toppings on one of the slices, but we'll call it equal for simplicity's sake.
Given n friends, I want to cut the pizzas in order to give everyone an equal--in shape and area--slice. What's the smallest amount of times I need to slice the pizza in order to make this happen? No folding allowed--the pizza must remain flat. Anything less than n=1 should return 0.
Circular:
Examples: Slice(1) --> 0
Examples: Slice(3) --> 3
Examples: Slice(4) --> 2
Square:
Examples: Slice(1) --> 0
Examples: Slice(3) --> 2
Examples: Slice(4) --> 2
Together:
Examples: master_pizza_slicer(1) --> 0
Examples: master_pizza_slicer(3) --> 5
Examples: master_pizza_slicer(4) --> 4
Similar Kata:
Stats:
Created | May 5, 2020 |
Warriors Trained | 35 |
Total Skips | 0 |
Total Code Submissions | 27 |
Total Times Completed | 10 |
Python Completions | 10 |
Total Stars | 0 |
% of votes with a positive feedback rating | 58% of 6 |
Total "Very Satisfied" Votes | 2 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 6 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |