Skip to main content
5 events
when toggle format what by license comment
Oct 15, 2018 at 23:42 comment added KennyColnago Mr.Wizard: Always WI. And thanks for your refined approach!
Oct 7, 2018 at 18:41 comment added Mr.Wizard FWIW this is faster when rewritten to use Ordering as follows: kcSum[u_] := Module[{s, best, m, t, k = 1}, s = Accumulate[u]; best = {m = s[[#]], k, k + # - 1} & @@ Ordering[s, -1]; While[Length[s] > 1, s = Rest[s - s[[1]]]; k += 1; t = {m = s[[#]], k, k + # - 1} & @@ Ordering[s, -1]; If[m > best[[1]], best = t]]; {#, Take[u, {##2}]} & @@ best ]
Oct 3, 2018 at 15:29 history edited KennyColnago CC BY-SA 4.0
included updated fn4 solution from Mr.Wizard
Oct 3, 2018 at 3:36 comment added Mr.Wizard Would you kindly include my newly-added fn2 in your benchmark? Thanks! :-) edit: might as well make it fn3
Oct 2, 2018 at 16:57 history answered KennyColnago CC BY-SA 4.0