Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • 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

    I disagree with you but have no recourse.

    I've written 3 different solutions that pass the sample tests in under 6000ms. However every time they fail the submit.

    The function with "return 1" barely completes faster than the alotted timeout. I still recommend having less tests or a random set of tests to allow for other solutions and to help others learn.

  • 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.

  • Custom User Avatar

    My PowerShell completes the test cases fine. However, it times out (12000ms is the limit) when attempting to solve. I changed my script so it just returns a number, no script, no logic, to see how long it takes to attempt with no work. The solve fails (as it should) in just under 11000ms. I believe there are too many unit tests for PowerShell to be able to solve this before the server times out.