Tech Interview

Gold Chain

A man has a gold chain with 7 links. he needs the service of a laborer for 7 days at a fee of one gold link per day. however, each day of work needs to be paid for separately. in other words, the worker must be paid each day after working and if the laborer is ever overpaid he will quit with the extra money. also he will never allow himself to be owed a link.

what is the fewest # of cuts to the chain to facilitate this arrangement and how does that guarantee payment?

Solution

Can we get change back from the laborer?

If so, we cut one link to make a chain of 4 links, a chain of 2 links and the cut link itself.

Day 1, we give him the cut link
Day 2, we take back the cut link, give him the 2 link chain
Day 3, we give him the cut link
Day 4, we take back both the cut link and the 2 link chain, give him the 4 link chain
Day 5, we give him the cut link
Day 6, we take back the cut link, give him the 2 link chain
Day 7, we give him the cut link

Exit mobile version