Open In App

Puzzle | Minimum time required to make N Pancakes

Last Updated : 18 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

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:

  1. If N = 1: This is a trivial case, where time to fry the pancakes is 2 minutes, as both sides need to be fried.
  2. 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.
  3. 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.
  4. 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.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads