Ad
  • Custom User Avatar

    It's hard to answer without spoiling the solution. 1/4 is the initial value, it's in C0 ([0,1]). For C1 the value you must control is no more 1/4, it changes on each iteration.

  • Custom User Avatar
  • Custom User Avatar

    @zhiburt, Yeah sorry...

    Translations of my Kata must be same as original (or as much as is possible for the language) else I won't approve them. So that means same kind of Random Test code too.

  • Custom User Avatar

    Not speaking for Dinglemouse but speaking for the quality assurance team at Codewars: this should not be approved then.

    Learn how to do random tests. Have a look at how Rust kata you have solved do it ( you can ), and steal from there what has already been invented. Copy the actual logic from the kata.

    Random tests really are essential to have.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Nobody can give you any hints without seeing your code. As B4B said, the linear solution (if we ignore the fact that arbitrary-length math affects the performance) takes approximately 1 - 1.5 sec in all languages, so your solution is a lot less efficient than you think.

  • Custom User Avatar

    it cannot be O(n) because the expected O(n) solution passes the tests in something like 2s. So you must have missed something that makes your code O(n²).