Author: | chunes |
---|---|
Mode: | factor |
Date: | Tue, 7 Dec 2021 07:57:06 |
"input.txt" ascii file-lines first "," split [ dec> ] map dup [ median ] keep n-v vabs sum . B dup mean 2dup 1 + [ >integer '[ _ - abs [1,b] sum ] map-sum ] 2bi@ min . ! previous solution only worked by happenstance. ! it turns out the median only guarantees you'll be 'close' ! to optimal. We have to check both integers lower and higher ! than the mean.
Author: | chunes |
---|---|
Mode: | factor |
Date: | Tue, 7 Dec 2021 07:58:40 |
s/median/mean and remove the B, oops