Ad
  • Custom User Avatar

    Removed some time ago

  • Custom User Avatar
  • Custom User Avatar

    Changed description to match the tests.

  • Custom User Avatar

    I fixed the description (start from the smallest sock and the largest gift, the last child is not special) and added small random tests.

  • Custom User Avatar

    wtf description says ALL buttons except the one triggering :/ I hate specs like this

  • Custom User Avatar

    Why on earth is this hidden? As long as the comment describes a correction to the description, and not a solution per se, it should not be flagged for spoilers.

  • Custom User Avatar

    No, when you find cheaters, feel free to report them here

  • Custom User Avatar

    fixed, also updated to new test framework

  • Custom User Avatar

    Damn, that's weird and genius actually

  • Custom User Avatar

    It's very obscure to figure out who exactly the "last" child is. I'm not convinced the kata expects correct results according to its own specification.

  • Default User Avatar

    Okay I did some tests because I agree with what you said and I found a funny little thing.
    First, here are the results for 10k tries on a random large test of this kata.

    Mine: 1.82sec
    Mine (fork): 1.22sec
    Yours: 2.14sec
    B4B's: 2.17sec
    

    So I tried to find out why and it seems python has an implementation detail that changes things.
    When doing string concatenation, if the left operator isn't referenced anywhere else, it is realloced to avoid creating a new object.
    This isn't something to rely on but that explains the difference between my original and my fork.

    However, I'm not sure why your solution is slower.
    Probably because you're constantly updating a dict.

    Edit: Alright, so my solution is better for big arrays and yours for big strings.

    1k tests, 1k length arrays, 50 length strings
    Mine: 14.06sec
    Mine (fork): 12.55sec
    Yours: 28.98sec
    B4B's: 27.95sec
    
    100 tests, 100 length arrays, 1000 length strings
    Mine: 12.24sec
    Mine (fork): 11.51sec
    Yours: 4.89sec
    B4B's: 4.78sec
    

    The difference between many small dict and a few big dict, the later is better.

  • Default User Avatar

    Okay, I just realised I already did a fork to solve that.
    Check it out.

  • Default User Avatar

    Do you see a linear time solution?

    Though this might be a cubic time solution, will check later. Too tired now.

  • Custom User Avatar

    In the context of this kata, it's a word that starts with a capital letter, maybe capitalized would be a better choice, but there are words with a mixture of letters in both cases and symbols. The definition of word is a little loose too, at least seeing the Python random tests.

  • Custom User Avatar

    In the example where it looped right I thought the end values would end up in reverse order at the beginning of the array e.g. loopArr([1, 5, 87, 45, 8, 9], 'right', 2) => [9, 8, 1, 5, 87, 45]. You should change the examples so there are not two of the same values for clarification, but other than that good problem!

  • Loading more items...