in reply to Re: partition of an array
in thread partition of an array
This approach is suboptimal for the following sample case:
my @kitties = qw/1 1 1 2 2 2 2 4/;
In this example, the greedy approach will fail, producing
[4,2,2,1], [2,2,1,1]
while the best solution would be
[4,1,1,1], [2,2,2,2]
But due to the homeworky nature of the problem I won't go into this further :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: partition of an array
by f00li5h (Chaplain) on Mar 25, 2009 at 06:44 UTC |