(Not logged on) | Register | Log On

You can subscribe to this discussion group using an RSS feed reader. techInterview Discussion

Answers to technical interview questions. A part of TechInterview.org

A part of techInterview.org: answers to technical interview questions.

Your host: Michael Pryor

synchronizing clocks on bottom/top of hill

There is a clock at the bottom of the hill and a clock at the top of the hill. The clock at the bottom of the hill works fine but the clock at the top doesn't. How will you synchronize the two clocks. Obviously, you can,t carry either of the clocks up or down the hill! And you have a horse to help you transport yourself. And, the time required for going up the hill is not equal to the time required to go down the hill.
TechCrazy Send private email
Saturday, July 24, 2010
 
 
What does it mean that the clock at the top doesn't work fine? Does it just display the wrong time? Does it not work at all and our goal is to know what time it is on the top of the hill? Somewhere in between?
d Send private email
Saturday, July 24, 2010
 
 
Picked from yahoo answers : -

You have to go up the hill and come back, with horse, without horse, getting four equations to solve four unknowns:
a) time to go uphill - with horse,
b) time to go uphill - without horse,
c) time to go downhill - with horse,
d) time to go downhill - without horse.

Then you can go up the hill and set the clock to '(time when you left) + (time to go uphill with horse)'
Gorav Jindal Send private email
Monday, July 26, 2010
 
 
d,

The clocks don't lose/gain time. They are just off a little.

we need to synchronize the times on the clock - they can be off a little when we start out. After we synchronize the times, they will display the same time.
TechCrazy Send private email
Monday, July 26, 2010
 
 
Gorav Jindal,

I worked it out using the algorithm you proposed. These 4 equations are not independent. The determinant is 0.
TechCrazy Send private email
Monday, July 26, 2010
 
 
Four /degenerate/ equations, since

up-with-down-without + up-without-down-with = up-with-down-with + up-without-down-without.
d Send private email
Monday, July 26, 2010
 
 
Since there are 4 variables, we can potentially form 6 combinations of  their sum. Is is possible to choose 4 independent combinations of sum from these 6 and then try them practically also?
Gorav Jindal Send private email
Monday, July 26, 2010
 
 
Powered by FogBugz