Another problem doing the rounds relates to random numbers. Unlike my previous post, this one might make a (difficult) interview question:
Given a function that generates a integer random number between 1 and 5, write another function that generates an integer random number between 1 and 7.
Obviously you are intended to use the first function for the random element in your solution, not the Random class.
I have been unable to come up with an exact solution that takes finite time for this. I have written some C# code that either gives an exact solution but can theoretically take infinite time, or gives an inexact solution (although to any level of accuracy you like).