Ad
  • Default User Avatar

    Well four years later and there are still people (like me) running into this problem. There's even a test case testing for n=250k...

    But I think that's a good thing, as I've learned something from that.

    I had to look up other people's solutions. As it turns out the only difference to my solution was a cast to double. Without the cast I had a ratio [1] resulting from the division of two integers. And it seems like summing up a bunch of ratios is very inefficient.

    [1] https://clojure.org/reference/data_structures#_ratio