an interesting google phone question
Software Engineer
Google
Full-time
Applied on line and got interview in a month.
The vending machine has 3 buttons A, B and C. But when you press A, there is a range of volume of drink you will get.
For example:
A: 200 ml - 210 ml
B: 500 ml - 510ml
C: 700 ml - 710 ml
You have a bottle that has a lower range and upper range. You could press any buttons many times, but you have to make sure that once you got a soda you pour it into the bottle. Makes sure that all the soda you got fall into the range of the bottle.
Find all the combinations of buttons to press that allow you to fill in your bottle
The vending machine has 3 buttons A, B and C. But when you press A, there is a range of volume of drink you will get.
For example:
A: 200 ml - 210 ml
B: 500 ml - 510ml
C: 700 ml - 710 ml
You have a bottle that has a lower range and upper range. You could press any buttons many times, but you have to make sure that once you got a soda you pour it into the bottle. Makes sure that all the soda you got fall into the range of the bottle.
Find all the combinations of buttons to press that allow you to fill in your bottle