GATE Computer ScienceVery hardGATE CS (PYQ pattern)
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 cannot be reused. The optimal worst case is 14 drops. For how many different floors x is it possible to make the first drop from floor x and still guarantee at most 14 drops in total?
- A. 6
- B. 1
- C. 14
- D. 5
Correct answer: A. 6
If the egg breaks at x, the floors 1…x−1 need x − 1 linear drops, so x − 1 ≤ 13, i.e. x ≤ 14. If it survives, 100 − x floors remain with 2 eggs and 13 drops, which cover at most 13·14/2 = 91 floors, so x ≥ 9. Hence x ∈ {9, …, 14}: 6 choices (verified by DP).
More Algorithms questions
- 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…
- A 6 × 6 grid is given row by row, where # is a blocked cell: row1 "....#.", row2 "..#...", row3 ".#..#.", row4 "....#.", row5 "#....."…