Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional
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 is that minimum possible largest sum?
- A. 18
- B. 19
- C. 15
- D. 16
Correct answer: A. 18
Binary search on the answer and check greedily how many parts a cap needs. The split [7, 2, 5] and [10, 8] gives max 18, and no split does better.
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
- 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]?
- A jump game on [2, 3, 0, 1, 4, 0, 2, 1, 3] starts at index 0; from index i you may jump 1 to a[i] steps forward. What is the minimum…