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?

  1. A. 2
  2. B. 3
  3. C. 1
  4. 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.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic