I solved the problem by taking the maximum weight first and then further checking if one more child can be fit into the same gondola. As per the question, atmost 2 children can only sit in one gondola but I was thinking if this constraint was not present then will the same solution work i.e first try to make sit all the heavy weights children till weight does not exceed x and then add new children of small weights till we did not exceed the limit. I am confused will the same solution will work or not Question link
Auto comment: topic has been updated by achhadahappy (previous revision, new revision, compare).
It does not: the resulting problem is NP-Complete (see for example Job Shop Scheduling).
Ohh, I was unaware that the new problem is an NP problem. Thanks, I learned something new applepi216