I have a logical problem.
I have a starting point A and ending point B. I have different sizes of blocks (42, 21) inches and a variable size filler box (can stretch from 7-26) inches. I need to fill the space so that the maximum size blocks are fit and then the remaining space is filled by the filler box.
for eg
a) if the gap is 50 inches, I will put a 42-inch block and a filler box ( 42 + 8*)
b) if the gap is 43 inches, I cannot put a 42-inch block because the remaining gap is 1 inch and I have nothing to fit in it. so I will put a 21-inch block and the filler block will take the rest of the 22 inches as it can stretch to 26 inches. ( 21 + 22*)
c) there are few exceptions like 48 - which cannot fit in the above rule set. but we can ignore those as the gap will rarely be 48 or 27. If it is, it will leave a gap and that is okay.