Puzzle: You have to make N (≥ 1) pancakes using a skillet that can hold only two pancakes at a time. Each pancake has to be fried on both sides. Frying one side of a pancake takes one minute, regardless of whether one or two pancakes are fried at the same time. What is the minimum amount of time required to fry the pancakes?
Solution: Let’s try to solve this problem case-wise:
- If N = 1: This is a trivial case, where time to fry the pancakes is 2 minutes, as both sides need to be fried.
- If N is even: The time, in this case, is N minutes. Since two cakes can be fried at one time, N/2 minutes are needed to fry the cakes on one side. Hence, the total time taken to fry the cakes on both sides is N minutes.
If N is odd: This case is a bit tricky. Let’s consider when the value of N = 3. We can fry 3 cakes in 3 minutes, as follows.
- Firstly, fry pancakes 1 and 2 on one side.
- Then fry pancake 1 on the second side together with pancake 3 on the first side.
- Finally, fry the pancakes 2 and 3 on the second side together.
- If N is odd and greater than 3: We can first fry the 3 pancakes in 3 minutes and then the remaining (N – 3) pancakes, which is even, in (N – 3) minutes.
- Find minimum elements after considering all possible transformations
- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 2 | (Find ages of daughters)
- Puzzle 3 | (Calculate total distance travelled by bee)
- Puzzle 4 | (Pay an employee using a 7 units gold rod?)
- Puzzle 13 | (100 Prisoners with Red/Black Hats)
- Puzzle 5 | (Finding the Injection for Anesthesia)
- Puzzle 6 | (Monty Hall problem)
- Puzzle 7 | (3 Bulbs and 3 Switches)
- Puzzle 8 | (Find the Jar with contaminated pills)
- Puzzle 9 | (Find the fastest 3 horses)
- Puzzle 10 | (A Man with Medical Condition and 2 Pills)
- Puzzle 11 | (1000 Coins and 10 Bags)
- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle 14 | (Strategy for a 2 Player Coin Game)
- Puzzle 15 | (Camel and Banana Puzzle)
- Puzzle 17 | (Ratio of Boys and Girls in a Country where people want only boys)
- Puzzle 16 | (100 Doors)
- Puzzle 18 | (Torch and Bridge)
- Puzzle 19 | (Poison and Rat)
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.