Google

  www.google.com
Work in HR? Unlock Free Profile

Google Operations Engineer Interview Question

I interviewed in Moncks Corner, SC and was asked:
"Given two buckets which you know to hold three gallons and five gallons, which have no graduations or other markings that would let you easily measure amounts less than 3 or 5 gallons of water, how would you measure exactly four gallons of water?"
Add Tags [?]
Answer

Part of a Operations Engineer Interview Review - one of 3,037 Google Interview Reviews

Answers & Comments

0
of 0
votes
There are two ways to do that, each has its Pros and Cons

Let's define the buckets first..

3-Gallon bucket = A
5-Gallon bucket = B

FIRST WAY: MORE STEPS and LESS WATER LOSS

Step ..............(A,B)

Fill A ............. (3,0)
Move A to B ............. (0,3)
Fill A ............. (3,3)
Move A to B ............. (1,5)
Empty B .............. (1,0)
Move A to B ............. (0,1)
Fill A ............. (3,1)
Move A to B ............. (0,4)

No. of steps is 8, Total Loss of water is 5 Gallons

SECOND WAY: Less STEPS and MORE WATER LOSS

Step ..............(A,B)
Fill B ..............(0,5)
Move B to A ..............(3,2)
Empty A ..............(0,2)
Move B to A ..............(2,0)
Fill B ..............(2,5)
Move B to A ..............(3,4)

No. of steps is 6, Total Loss of water is 6 Gallons
- Toufik Kannab on Jul 21, 2013

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.