Oracle Interview Question: Two people are each stuck on ... | Glassdoor

Interview Question

Software Engineer IV Interview Santa Clara, CA

Two people are each stuck on their own island, connected by

  a ferryman with a lockable box. Each person has their own lock and key, but can't send the key along with the box. One person wants to send the other a diamond, but it must be placed into the box and locked or it will be stolen by the ferryman. How do you send the diamond without the ferryman stealing it?
abstract synonym flow charting

Interview Answer

6 Answers


This is an analog version, if you like, of public key encryption.

Interview Candidate on Apr 12, 2012

1) person A sends key only in a unlocked box to person B.
2) person B sends key only in a unlocked box to person A.
3) 3rd trip person A puts diamonds in the box snaps the lock their holding closed. (At this point owner of the lock can't open the lock. Ensure all contents are in the box before engaging lock.)
4) once the lock box arrives to person B, they can use the key provided on the trip before to open and stare at the contents, And realizes he can pay the ferryman to give him/her ride off the island. Then place a thank you note in the box and close with lock initially held by person B and which now person A has the key.

Option B for #4 step) send a thank you note and lock with which the diamonds were so cleverly send to you sealed with. ;)

*** Now follow up question would be, how to ensure the ferryman didn't copy the keys during the first transfer of keys?
 Answer) well, I guess you could have exchanged open locks and not the keys between the two people, and if he could copy a lock on a boat - the ferryman should be looking into more rewarding currier.

But why do they care about diamonds when their stuck on an island, not stranded just stuck - pay the ferryman. There is always a man in the middle, know what to trust and what not to. Focusing on security when you may have bigger problems is useless.

Paresh on Dec 15, 2012

A comment:
What if the ferryman never comes back after you send your diamond first to other person with the locked box?

Do you believe the other person is in with the ferryman?
Did person A Paid the ferryman to take him/her off the island?
Did the ferryman just take off with both of you in the dark?
Did the boat sink?

This is for sure "thanks for coming in, but you should only answer the question best possible without asking any questions. We can't have you make the BAs put details in specs - we would just have code it. Next please..." But here it goes,
So did you chain lock your bike around its frame in high school?

- since when did it become not ok to really express your thoughts when all job descriptions read: self motivated, talented, team player and innovative persons this is for you when your not allowed to engage in interviews in the same manner you would when your working there? Why does the interview meeting nothing like what the work environment will be? I hope most of these places you don't have 5 people show up at your cube and just ask you to loop using a for construct and alert different messages at patterned criteria, then just walk away with out telling if you did good or bad.

Just getting ready for this process after 15 year. Well for the first time really I only worked for one employer all my life and internal interviews are not the same as with people who need to just weed out people on both ends of the bell curve.

Must you just play along and give the answer 514 gives thumbs up to on three job and social sites? Or can you ask questions and be really who you are? Would love feedback.....

Paresh on Dec 15, 2012

This isn't meant to be an open-ended question. It's a test of your problem-solving abilities, and a good interviewer will say that up front.

In technical interviews these days, interviewers want to know how you would attempt to solve problems you haven't seen before, or that don't seem to have a clear and obvious answer. For example, in this problem an important piece of information that wasn't presented is that the box can be locked with more than one lock. Once you realize that it's a much easier problem.

If you haven't interviewed outside of your present company for a long time you have to remember that you're meeting a lot of people who know nothing about you other than what's on your resumé and are counting on the interview to determine whether or not you can do what your resumé says you can do.

Be prepared to answer questions that show you can implement an algorithm given to you, or that you understand basic data structures and programming techniques. I also recommend the book "How to Land The Tech Job You Love", especially if you haven't done any interviewing in some time.

Scott on Dec 15, 2012

Scott thanks for the feedback.

How did you know they didn't present the dual lock sync option because its going to be implemented in pascal 5.0 and you can't gain dual locks to a resource. And if they did leave out vital information like that to dirty the waters why would expect implementation that didn't use the benefits of dual lock?

The only thing that can move you closer to a solution to an unknown problem is more information, granted you understand the current known constraints and resources and know for fact they yield a solution with gaping holes to any solution you present. So than go with good enough and work within what you have or ask questions, same questions in different tones, different order anything but how can a sr. Engineer ignore pitfalls and not show a better way to do things?

I spent 3 hours in 1st interview and 1 hr in a second - wasn't sure I applied for the right job 2 hrs into it and when presented with the FizzBuzz type questions, I had to ask why the inter type questions? - they said not many that come could answer some of thee. I don't know it all or even a little sometimes but I can't the job description from recruiters before applying for the position, can't ask questions to ensure I would be engaged in the job I'm being grilled for.

But have you noticed the intertwine description and title on the improper use of engineer and developer? And how 70-75% of description are similar to the word for related job areas? None have anything to say about what you'll be doing other than: working in a fast paced, agile, team and solo, innovative company, exciting pop. , self-starter..... You get it. Two java developers sitting next to each other on the same team maybe working on very different projects and areas of computing, same with UI dev. for openGL is not the same as Core Animtion. Granted a talented developer should be able to do both and cut java script and CSS without RAD tools but why the deliverable project not discussed and how to approach it and common QAs printed off from google search "software engineer interview questions" - on of my sessions person asking the question actually said here is a popular question and printed out the question and presented it.

And I just ask this so I can find the job I love and not hate 12 hr every 5 days of work and be engaged and give the employer my commitment to return in value what they pay me. I hope and strive not to deceive in any manner, it seems giving the right answer is no longer correct - you need to give measurable and a comparable answer so you can become a dot on a graph.

But I do appreciate your comment and just venting about broken processes in an industry that is becoming less effeicient and from top to bottom, everyone hitting the pewllow at night saying not in my job description to get involved. And computing has a lot to offer all of us to become a better, heather and wiser and at the very core is one mind that is a computer but its been too busy processing finding errors and validating things it should know, or does know but developers and engineers applying for senior level positions need to be asked to write out a for loop. Kind of reminds me of the Finacial Industry, don't you think?

Sorry about the rant, but I wil check out the book you suggested and I hope it's not another keywords to use, standardized resume somehow will make me standout.

I found this to be interesting perspective if your qurious, won't tell you my perspective but a good read

Paresh on Dec 15, 2012

Step 1: The person with the diamond, puts it in the box, locks it with his lock (Let's say Lock1). The ferryman takes it across.
Step 2: Person 2 locks the box again with his lock (Lock2) Sends it back with the ferryman.
Step 3 : Person 1 unlocks Lock1. Sends it back.
Step 4 : Person 2 unlocks Lock 2 and retrieves the diamond.

Anonymous on Nov 25, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.