Adobe Interview Question
Developer Program EngineersCountry: India
Interview Type: In-Person
There are a lot of loop-holes in the question. It can either be exploited as an interviewee, or the answers can be countered by the interviewer.
Your solution is correct, however, I might ask, where is it written that more than one lock can be put on the box?
I think more than 1 lock can be put on the box is not really a problem.
How ever, this answer can be exploited by M as follow:
1. M doesn't send the box to B,
2. M locks it with his fake KeyB and send it back to A
3. A release the LockA
4. M open the box with his fake KeyB.
If the locks cannot be faked then the given answer should be correct :-)
Another possible solution could be :
Step 1: A will lock the box with KeyA than send it to B
Step 2: B on receiving keeps the box and send the messenger back to get the key.
Step 3: A send the key.
Step 4: B unlocks the box using the key.
it is also possible that messenger didn't deliver the box to B, or gave a wrong box and then asked for the key from A, not a correct solution.
Step 1: A will lock the box with KeyA than send it to B
- Pranav July 03, 2012Step 2: B on receiving locks it again with KeyB and send it to A
Step 3: A will release its lock with its KeyA and send it back to B(its is still locked with KeyB).
Step 4: B upon receiving will open it with KeyB.