Ad
  • Custom User Avatar

    The random tests expect integer Numbers, not rationals.

    Note that JS uses IEEE 7something numbers internally, which can be approximations. Make sure to keep your intermediate results integers, or you will run into these problems.

  • Custom User Avatar

    indexOf is a loop-alike method, it's inside a loop, so your code is O(n2) Try another algorithm, a faster one.