This is a simple probability problem. I lost my old code. But based on the discussion thread, I guess I used a Markov-Chain approach. This time, it puzzled me for half an hour. I suddenly figured out that this is similar to the "birthday problem", then it is solved. It only takes 200 ms for my new code. I then considered the symmetric property, the run time is reduce to 50 ms.
No comments:
Post a Comment