# Divide a curve with a combination between different segment lengths

Hello there,

I am trying to figure out a way to find the best combination of multiple segment lengths given a rule for the remainder.

Given any curve of length L, a list of possible segment lengths and setting a minimum and a maximum Remainder values I want to find the combinations that satisfy the rule.

Not all the possible lengths must be used.
“N1,N2,…” in picture are Integers

After some work I have been able to get all the Remainder values that satisfy the rule, however I was not able to back trace the respective combinations in order to chose one of them.

Hope anyone has tackled this before and can give a hand.
Thank you

you can approach this the very same way as a coin change problem, with -if I have understood correctly-the variation that you are also ok within a range of reminders

your final aim is to get the one solution that minimizes the reminder (in the range min<R<max) ?
or you want the solution that best minimizes/maximizes the Ns while keeping the reminder in the range min<R<max?