This problem is not very interesting. It is not difficult at all. A brute force solution is easy to be coded in 5 minutes. But one potential issue about accuracy may exist. I learned one trick from the discussion that removed the sqrt computation from most of my code. My original code runs for 1.2 second and my new code only needs 0.17 second.
The background of this problem is very famous. Those guys in discussion are quite knowledgeable. It seems that they knew everything about math and coding.
No comments:
Post a Comment