[UPHPU] The Lost Sheep Challenge
Jonathan Duncan
jonathan at bluesunhosting.com
Tue Oct 2 16:02:44 MDT 2007
Begin forwarded message:
> From: "Sasha Pachev" <sasha at asksasha.com>
>
> A question was asked a friend of mine during his interview with
> Microsoft. It is hard to believe that I would have a friend that would
> even consider interviewing with Microsoft, or at least I would be
> ashamed to admit it on this list, but well, I do :-)
>
> I decided to port this problem to the New Testament theme, and also
> make it more friendly for non-programmers. Anybody who knows how to
> use a calculator should be comfortable with it. So here it is:
>
> You have 100 sheep in a flock and they are all numbered. Each has an
> identification tag with a number - 1 through 100. One of them is
> lost. Other sheep are scattered over the pasture and cannot be
> examined in sequential order of their numbers. Come up with a method
> that would allow you to quickly identify the lost sheep. The use of a
> simple arithmetical calculator is allowed. The use of a pen or any
> other note-taking instrument is not (to disallow the trivial but
> unscaleable roll-call method).
>
Those on the PLUG list already saw this, but I thought it might be a
fun way to exercise your PHP and math skills on. I came up with a
PHP solution. Now I would like to see how others would solve the
same problem.
Jonathan
More information about the UPHPU
mailing list