twistur:I'm still into this. The problem is very engrossing that usually I failed to notice that I had been working up to the wee hours of the morning already! Now, that's someting I can't afford to do often.
The nice thing about this problem is its not data centric at all so any computer geek out there has a chance on this. I've been rummaging online resources and books about this and I am amazed by the amount of info I've waded (and learned ) just to find out solution for this problem. I have one apprehension though. Based on what I've read so far, the amount of test data that sir gg is proposing might take inifinitely long time to solve. Besides, I rather prefer a small data set with the predetermined correct combinations so that the correctness of the algorithm can be readily determined. It's not safe to just rely on the submitted script to determine the possible combinations. Just a suggestion sir.
(wink). i never thought you will actually attempt to test it at 10000 rows. what i am expecting is that contestants will try their algo on 10s, 100s of rows and come up with their own testing methods (i mean their own predetermined correct combinations) which i think as so easy to do. solve the problem first and we will deal with your apprehensions later :) your apprehensions should not prevent you from coming up with the fastest and correct query.
here is my suggestion, submit your solution first so others can take a look at this and scrutinize it and question if it's not the right solution.