GATE Computer ScienceVery hardGATE CS (PYQ pattern)
The egg-drop puzzle: a building has 100 floors, and you have 3 identical eggs. An egg that is dropped from a floor at or above the critical floor breaks and cannot be reused; otherwise it can be reused. What is the minimum number of drops that suffices to determine the critical floor in the worst case?
- A. 9
- B. 7
- C. 11
- D. 14
Correct answer: A. 9
With t drops and e eggs one can cover f(t, e) = f(t − 1, e − 1) + f(t − 1, e) + 1 floors; for e = 3, f(8, 3) = 92 and f(9, 3) = 129, so 9 drops are needed for 100 floors. With 2 eggs the answer would be 14.
More Algorithms questions
- A building has 100 floors and you have 2 identical eggs; an egg breaks when dropped from the critical floor or above, and a broken egg…
- Floyd–Warshall is run on a 5-vertex directed graph with weight matrix (rows are sources, ∞ = no edge): row1: [0, 6, ∞, 3, ∞]; row2: [∞, 0…
- Six jobs have (processing time, weight): (4,3), (2,5), (7,2), (3,6), (5,4), (1,1). A single machine runs them one at a time without gaps…
- How many non-empty subsets of {3, 5, 6, 7, 9, 11, 13, 14} have an element sum divisible by 10?
- A cyclic binary string of length 12 is written around a circle, so position 12 is followed by position 1. How many of the 2¹² strings…
- What is the maximum possible sum of a non-empty contiguous circular subarray of A = [6, −4, −7, 5, 3, −2, 8, −6, 4, −1] (the array is…