balls

On paypal’s site in their jobs section there are the following two questions:

  • You are given twelve balls. All are the same size and weight, except one which is heavier or lighter than the others. Using a balance scale, can you determine the odd ball in three weighings?
  • Write a function which reverses all the words in a string, using no local storage. (Turn “this is a test” into “test a is this”.)

I like playing with such things, but before I had a chance to do the first one Gabe and Wayne figured it out. =) Using their ideas I then made up a diagram of the solution. If you think you can figure it out give it a shot and then something close to the answer Wayne and Gabe got (I just remember the principle they used and I assume I applied it in the same way) is at:

http://odin.himinbi.org/paypal/balls.svg

There is a program to do the second problem in that same directory as well if you are entertained by such things.

To see the balls one you will have to be on a machine that has a svg viewer installed. This includes just about all of campus since the Adobe svg viewer is on all of them. I don’t know if it comes with Acrobat 5 or what, but it is there.

Anyhow, it took me like an hour and a half to write out the graph because I did it in emacs cutting and pasting over and over and it is a 600 line xml file. Something mindless like this always seems to get entertaining when I have bunches of stuff looming. I figured as long as I put the time into it I would go ahead and share. =)

Well, I guess I’ll do actual work now.

Ttyl

Will

P.S. You can zoom in with the Adobe by holding control and selecting a part of the picture. Zooming in on svg’s is one of their neatest features imho.

Leave a Reply

Your email address will not be published. Required fields are marked *