Problem 466C

Revision en1, by ebanner, 2016-10-29 19:46:02

This is documentation for my solution to 466C - Number of Ways. Credit for Coding Hangover for the algorithm. This post will detail the approach here, as well as provide an example.

Problem Statement

Given an array arr, we are to compute the number of ways we can partition arr into chunks where each chunk is contiguous. Further, the sum of the elements in each chunk must be the same.

Naive Approach

My first approach to this problem was to pre-compute an array A which is a running sum of arr. Concretely, A[i] = sum(a[:i]) inclusive.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en7 English ebanner 2016-10-29 21:29:39 259 (published)
en6 English ebanner 2016-10-29 21:27:49 527 Tiny change: 'nk sum up up to the' -
en5 English ebanner 2016-10-29 21:06:10 3732
en4 English ebanner 2016-10-29 20:40:43 1001 Tiny change: 'explained along with an e' -
en3 English ebanner 2016-10-29 20:15:37 1803
en2 English ebanner 2016-10-29 19:55:58 884
en1 English ebanner 2016-10-29 19:46:02 658 Initial revision (saved to drafts)