think you're good at puzzles? try this one.

I ran
across this puzzle
a little while ago. I’m still working on it –
now you can too:

You
have a port that you are reading numbers from. You know that there is one number that
is generated in more than half of the cases. You keep reading numbers arbitrarily
long until you are given a command to stop. When you stop you have to return the number
that has occurred in more than half of the cases.

(Hint: you don’t
have enough memory to store all the numbers)