Well here is the next problem.
A family was out on a vacation and came to a pulley bridge, now they had thirthy seconds to get across before they completely lose all light. Now the members of the family and the time they take to cross the bridge are as follows:
(1) Grandpa - 12 secs to cross.
(2) Father - 8 secs to cross.
(3) Mother - 6 secs to cross.
(4) daugther - 3 secs to cross.
(5) son - 1 sec to cross.
Now the bridge being a pully a maximum of two person can go across but one person have to carry it back. Here are the rules for crossing:
(1) When 2 persons are crossing the person with the longest time to cross is the time it takes to get to the other side. eg, if the father and the Son is crossing the time to get across is 8 seconds.
(2) The time going back is also calculated, e.g. if the father and the Son is crossing the time to get across is 8 seconds.. Now logically in the interest of time you will let the son go back. This trip in it's totality will take 9 secs, 8 secs + 1 sec to get back.
Now in designing your algorithm do not design a algorithm that solves this problem. Design a generic one where if i change the number of family members it still work.
I have not seen or done a solution as yet so i cannot suggest a LOC acceptable limit.