Ad
  • Custom User Avatar

    You are right at one thing: reference solution used by tests is terrible and probably uses up significant amount of time quota, stealing it from your solution. I think I am going to fix it some time. But I do not agree with you (for the time being) that it really needs to be changed, since efficient, yet quite basic (i.e. conforming to my perception of 6 kyu kata) solution takes below 10 seconds of total time.

    Am I right to assume that each of your three solutions contained a loop? Did you consider a solution without a loop, with O(1) complexity (i.e. takes the same amount of time for n=20 and n=20000)? If no, then please think about the solution without a (explicit or implicit) loop. However, if you are sure that your solution is O(1) and tests are really at fault, then please post your code here (remember about spoiler flag!) or in kata-solving-help Gitter channel, we will take a look, and if it is indeed so, I will take care of fixing the tests.

    Okay, so I checked other accepted solutions and it tunrs out I was wrong, and I am sorry for misleading you. It turns out that PowerShell version, similar to other language versions, also accepts loop-based, inefficient, O(n)-complexity solutions. This leads me to believe that your solution is really non-performant, and you can post it here for us to see and eventually help.

  • Custom User Avatar
    Time: 10233ms Passed: 204 Failed: 0
    Test Results:
     Fixed Tests
     Should Pass
     ...snip...
    Completed in 858ms
     Random Tests
     Should Pass Random Test
     Should Pass Random Test
     ...snip...
    Completed in 4443ms
    You have passed all of the tests! :)
    

    While it is true that other language versions accept totally inefficient solutions and PowerShell version requires an efficient one, I'd stand that required complexity is not above 6 kyu level. Use efficient solution and you'll be guaranteed to pass.