# Solution : 3 Trips (and even better solution with only 2 trips)

Tags: #<Tag:0x00007f1823039a20>

#1

Alice has : Medicine, LockA, KeyA
Bob has : LockB, KeyB

Solutions:
3 Trips (This is the solution accepted here by InterviewBit):
Alice places the Medicine inside the chest and locks with LockA (keeps his KeyA with himself).
Eve transports (Trip 1) the Medicine to Bob. But Bob cannot open it.
So Bob locks the chest with his LockB.
Please note that at this state, the chest has both the locks. ie. LockA as well as LockB.
Eve transports (Trip 2) back to Alice with both the locks.
Now, Alice unlocks his LockA, and keeps it with himself. But still, the LockB is on the chest (so Eve cannot steal the medicine).
Eve transports (Trip 3) to Bob with only LockB.
Bob unlocks his LockB and gets the medicine.

2 Trips (This solution is even been better, but not accepted by InterviewBit):
The question mentions that the locks are actually of type padlock. So the hasp and staple of the chest can be locked using this lock.
Bob applies his LockB only at the staple and leaves the hasp free, ie. the chest is still open with nothing inside it.
Eve transports (Trip 1) to Alice.
Alice now places the Medicine into the chest and locks it with LockA such that the LockA is connecting LockB to hasp.
So the current state is such that the sequence of locks forms a chain like this :
[chest’s Staple] —connects— [LockB] —connects— [LockA] —connects— [chest’s Hasp]
Eve transports (Trip 2) to Bob.
Now, if either of the locks are opened the chest will be get opened.
So, Bob simply opens LockB and gets the medicine.