Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional
In how many ways can [1, 2, 3, 0, 3] be cut into 3 non-empty contiguous parts such that all three parts have equal sum?
- A. 2
- B. 3
- C. 1
- D. 0
Correct answer: A. 2
The total is 9, so each part must sum to 3. The first cut is after prefix sum 3, and the second cut can be after prefix sum 6 at either of two positions, since the element 0 can fall on either side.
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 length of the longest contiguous subarray of [1, 5, 6, 2, 8, 3] whose maximum minus minimum is at most 3?
- Meetings occupy the half-open intervals [s, f) listed as (1,2), (3,4), (0,6), (5,7), (8,9), (5,9). Only one meeting may use the room at a…
- Children have greed factors [1, 2, 3] and cookies have sizes [1, 1]. A child is content if assigned a cookie of size at least their greed…
- From the digit string "1432219" remove exactly 3 digits (keeping the remaining digits in their original order) so that the resulting…
- How many contiguous substrings of "abcabc" contain exactly 2 distinct letters?
- How many non-empty contiguous subarrays of [1, 3, 6, 10, 2, 6] have a sum that is a perfect square (including 1, 4, 9, ...)?