You are viewing a single comment's thread. Return to all comments →
Why does this work? In the case you have the list of squares [1,1, 3, 3, 2], m = 2 and d = 3, there are two positive cases of [2,1] and [1,2]. However, your code gives returns 0.
The only way this makes sense is the assumption the pieces must be consecutive to sum, but I didn't see that mentioned in the problem.