in reply to Re: sum towards nearest good neighbor at either end of numerical array (partition off by one )
in thread sum towards nearest good neighbor at either end of numerical array

awesome solution,
*bows in respect
update* though if the original array will be
(1, 1, 0, 3, 8, 9, 5, 2, 0, 2, 1)
that would give  [[1, 1, 0, 3, 8], [9], [5], [2, 0, 2, 1]]
and if the author want's values be around 5, that's not very good
also if the original massive will be (1, 1, 0, 3, 8, 9, 5, 2, 0, 12, 2, 1)
that would give a completely wrong answer:
[[1, 1, 0, 3, 8], [9], [5], [2, 0, 12], [2, 1]]
  • Comment on Re^2: sum towards nearest good neighbor at either end of numerical array (partition off by one )
  • Select or Download Code