Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
okuli
· 11y ago · 0 comments
Ran both your inputs and get exactly the same results, also can't figure out where's the error. Apparently there's some edge case when you should use different strategy than splitting it in 2 equal piles.
Comments
[–]
imaginenore
11y ago
Finally solved it. Apparently splitting in half isn't always the optimal step, sometimes you have to move a different amount.
Example:
9 3 3
6 3 3 3
3 3 3 3 3
2 2 2 2 2
1 1 1 1 1