Dynamic programming · 13 / 15 Exercise Hard

Split into two equal halves

Objective

Can a list of numbers be split into two groups with the same sum? It is the subset sum problem: you look for a subset that adds up to half of the total. If the total is odd, it is impossible.

Instructions

  • Read a line of positive integers.
  • Show Can be split or Cannot be split.
Input
1 5 11 5
Output
Can be split

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise