hi all,

Brute force solution is find max of sums of items inside Cartesian product.

There is my implementation, create list of all products on rosetta:

Test input of task is 81 items in list, its ok for rosetta's variation.
Cartesian product of real input is 37B items in list.

Time to implementation Cartesian iterator, like in python:

There are three variations with the same original engine inside:
o) on coroutines - product
o) manual sum all numbers of product - cartesian-sum
o) find max of sums of items of product - cartesian-maxi
Tests over each other and against rosettacode variation.

Current bench, 4M items in product, sum all numbers:
o) coroutines - 1.9secs
o) manual - 1.4secs
Its ok.

Happy coding,

UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to