Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
Piles of bananas are [3, 6, 7, 11] and you must finish all piles within 8 hours, eating at speed k bananas per hour (taking ceil(pile / k) hours per pile). What is the minimum integer k?
- A. 3
- B. 5
- C. 7
- D. 4
Correct answer: D. 4
At speed 4 the hours are 1 + 2 + 2 + 3 = 8, which fits. At speed 3 they are 1 + 2 + 3 + 4 = 10, which does not fit, so 4 is the minimum.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- The array [7, 2, 5, 10, 8] is split into exactly 2 non-empty contiguous parts so that the largest part sum is as small as possible. What…
- How many non-empty contiguous subarrays of [4, 5, 0, -2, -3, 1] have a sum divisible by 5 (including negative sums, which are divisible…
- An array of 6 zeros (indices 0 to 5) receives three range-add operations, each adding v to every index from l to r inclusive: (1,3,+2)…
- The stock span of day i is the number of consecutive days up to and including i with price at most price[i]. What is the sum of the spans…
- For the circular array [1, 2, 1], the next greater element of each position searches forward and wraps around to the start, with -1 when…
- What is the sum of the minimum of every contiguous window of size 4 in [8, 2, 6, 1, 9, 3, 7]?