A tough problem with homework. This is, in fact, an optimization version of the problem with 3 sections.
http://en.wikipedia.org/wiki/3-partition_problem
It is closely related to the packaging, section, and subset of the bin (and, as you noted, a backpack). However, this turns out to be strongly NP-Complete, which makes it harder than its cousins. In any case, I suggest you start by studying dynamic software solutions for the problems associated with them (I would start with a section, but find a non-Wikipedia explanation for the DP solution).
Update: I apologize. I misled you. A task with three sections splits the input into groups of 3, not 3 sets. The rest of what I said is still applicable, but with the new hope that your option is not completely np-complete.
source share