Wednesday, August 29, 2012

Bridge Puzzle

Q : Arrive with a solution where all the 4 people will cross the bridge with less than 17 as a total value.

Four People have to cross a bridge from A to B. Example W,X,Y and Z. W has a value 8, X has a value 5, Y has a value 2 and Z has a value 1.

Limitations :
  • Maximum Two people can travel at a time. The Maximum Value of the two is considered.
  • Only one Lantern is there which has to be carried to cross the bridge.

Solution : 

Solution with value count = 17.

Step 1 : Y and Z travel together with the Lantern. Max value of Y and Z, Y = 2. Count = 2
Step 2 : Z comes back with the Lantern.Return value of Z = 1.Count = 3
Step 3 : X and Z travel together with the Lantern. Max value of X and Z, X = 5.Count = 8
Step 4 : Z comes back with the Lantern.Return value of Z = 1.Count = 9
Step 5 : W and Z travel together with the Lantern. Max value of W and Z, W = 8. Count = 17

Solution with value count = 15.

Step 1 : Y and Z travel together with the Lantern. Max value of Y and Z, Y = 2. Count = 2
Step 2 : Z comes back with the Lantern.Return value of Z = 1.Count = 3
Step 3 : W and X travel together with the Lantern. Max value of W and X, W = 8.Count = 11
Step 4 : Y comes back with the Lantern.Return value of Y = 2.Count = 13
Step 5 : Y and Z travel together with the Lantern. Max value of Y and Z, Y = 2. Count = 15

No comments:

Post a Comment