Hi everybody,

I'am coding Lingo without really having learned how to program. Sometimes I
am too dull to figure out how things could best be done.


Now that has happened again:

Imagine you had a given length. Like:

length = 315

And you needed to cover that length with smaller pieces. You had a set of
pieces of a given length, like for instance:

piecesL = [13, 27, 35, 48, 90, 111, ...]


Now the algorithm I am looking for should chose any number of the pieces in
piecesL and add them up the the given length. The pieces can be used several
times. If the full length cannot be achieved because of the given values,
the one solution should be found that comes closest.

So I need a solution in the style of

solutionL = [13, 13, 13, 27, 90, 90, ...]

As I said, a question (challenge?) for a "real" programmer.

Asked by a thankful "amateur".

Michael von Aichberger


[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to