#toyprogrammingchallenge

Okay, here is another freebie :) I will put in a real one before the end of the weekend.

Basically, you are given a list from which you need to create a new list where each element is the product of all the "OTHER" elements.

I found a few interesting corner cases.

I challenge you to give it a try!

Read the challenge here:

https://git.qoto.org/Absinthe/productnot/blob/master/README.md

My attempt is checked into that repo as well.

README.md · master · La Fée Verte / productnot

GitLab Enterprise Edition

@Absinthe I didnt get the chance to do the last one... This one is super easy but the follow up is kina cool. I can see a way of doing the follow-up in log-time, anyone have anything better?

@freemo @Absinthe
My attempt without division
https://git.sr.ht/~namark/mercury_stuff/tree/master/toys/other_product_no_div.m
It's linear but requires 3x the space. The idea is to calculate partial products of the list, from left to right, and right to left, then the final values based on corresponding neighbouring values in partial product lists.

Probably the worst explanation and my mercury code seems unreadable to me, so here's a c++ version
http://ix.io/1KzG/cpp

#toyprogrammingchallenge
#mercurylang #cpp

~namark/mercury_stuff: toys/other_product_no_div.m - sourcehut git