Tuesday, April 21, 2009

solution: buried treasure

Solution: 5*4 - buried treasure

The answer to this question is that yes, the treasure can be found without knowing the original starting point.

Solution: Let us discuss the problem using x,y coordinates, where x represents the east-west direction and y is north-south. Start at (a,b) and let the landmarks be (c,d) and (e,f). To reach the location for the first stake, you will go from (a,b) to (c,d), which takes you c-a in the x-direction and d-b in the y-direction. You then turn and go the same distance in a perpendicular direction, which means that c-a is a vertical distance and d-b is a horizontal distance.

The coordinates of the two stakes can be expressed as (c-(d-b),d-(a-c)) and (e+(f-b),f-(e-a)). Their midpoint, the location of the treasure, is ((c-d+e+f)/2,(c+d-e+f)/2), which is strikingly independent of a and b, the coordinates of the starting point. This means that if we changed the starting point but followed the same directions, we would arrive at the same location and find the treasure.



This does of course assume that the field is a plane.

I first came across this problem at http://www.techinterview.org/. This is a very neat website.

No comments:

Post a Comment