Sandvine

  www.sandvine.com
  www.sandvine.com

Interview Question

Quality Assurance Engineer Interview(Student Candidate) Toronto, ON (Canada)

Your friend has a program which he builds automatically

  each day. He is going away for 10 days and he asks you to look at the build results each day and let him know the day the build fails. He comes back on the 11th day and his boss asks him about the build results. You forget to monitor the build results and when you check on the 11th day, the result is a fail. How would you tell which day the build failed in the least number of tries by looking at the results.
Answer

Interview Answer

1 Answer

0

Use Binary Search.
Chose the middle which is day 6. If fail, then go left, if passed go right. So the least number of tries is 4

                                      6
                               / \
                              3 9
                           / \ / \
                          2 4 8 10
                        / \ / \
                       1 5 7 11

Dominator on Sep 2, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.