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.