Originally posted by: ReelC00L
Originally posted by: ReelC00L
#1: You have 8 balls, 1 is lighter than the others but not visually obvious which. You have a balance scale and are only allowed to weigh them twice. How do you figure which is the lighter one?
#2: You have a lock box and need to ship me some diamonds. Anything shipped in the box must be locked or it will be stolen. You have n locks + keys and I have n locks + keys. Any of your keys works on any of your locks and any of my keys work on any of my locks but not each other's. You can ship the box back as many times as you need. How do you get the diamonds to me?
Bonus: relate it to something in computers.
#3: Define the objects (as in OO Programming) that you would need to create the game pac-man.
#1: my answer has been said here. 3 vs 3, go on from there. I figured this one out pretty quickly.
#2: my first answer was not the best answer but it impressed the interviewer because nobody had ever given that answer before. I had suggested something similar as said above where the receiver sends me a lock locked to the outside of the box but not locking the key in. It wasn't the best answer because security was compromised by sharing the key. Then, I rethought it and gave a better answer. Then he pointed out that it would be wasteful on "bandwidth" to send the diamonds 3 times. The best answer that I came up with was only sending the diamonds once and not sharing a key. I can't remember the details of the solution right now. I'd have to think about it but that should be enough to get some of the guys in the forum thinking of the answer.
#3: We really didn't spend a lot of time on this. I just suggested a few objects: Pac-man, ghost, dot, cells. Those were my framework for the pac-man game. He said we could have spent half an hour on this problem on its own but since time was limited, we would stop there.
Number 2 should be the easiest one. Have him send you an empty box. Put the diamond in it, lock it and ship it back to him. He can open the box with his key.
