Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
A conveyor must ship packages with weights 1, 2, 3, ..., 10 in the given order, in at most 5 days, and loads cannot be reordered. What is the minimum ship capacity needed?
- A. 14
- B. 10
- C. 17
- D. 15
Correct answer: D. 15
Binary search the capacity between max weight and total weight, and test feasibility greedily. Capacity 15 needs exactly 5 days; capacity 14 needs 6, so 15 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
- What is the sum over all subarrays of [3, 1, 2, 4] of the minimum element of each subarray?
- Using a monotonic deque, the window maximum for every window of size 3 over [1, 3, -1, -3, 5, 3, 6, 7] is listed left to right. What is…
- In the array [1, 2, 1, 3, 2, 5] exactly two values appear once and every other value appears twice. Which two values are they, as a sorted…
- What is the value of sum of popcount(i) for i from 1 to 20 (number of 1-bits in the binary form of each i, summed)?
- For the array [6, 12, 5, 8], what is the sum of (x & -x) over all elements x, where x & -x is the lowest set bit of x?
- How many contiguous subarrays of [1, 2, 4, 3, 6] have a bitwise OR equal to exactly 7?