6 kyu

Untangle list deletion/insertion

Description
Loading description...
Mathematics
Performance
Algorithms
  • Please sign in or sign up to leave a comment.
  • natan Avatar

    the tests allocate about 1GiB as "junk" and then about another 300MiB - this still leaves 8.7GiB usable memory (yes, there's a whole 10GiB available)

    without a limit of memory this becomes a completely different (and trivial) kata, and looking at recent solutions most of them use O(n) memory, and even some of the oldest ones do too even if it might have been tighter on memory then (but probably still many times what was needed).

    my (presumably invalid) solution strictly speaking only needs 672KiB (1 bit each) or 42MiB with a python list (64 bits per reference)

    ... should the kata be retired? at best a limit could be set on the process with the resource module and then disallow numpy/mmap but like.. you can still use plain files or if using 672k memory then it's practically impossible to enforce. allocating nearly all of the 10GiB as resident memory takes a lot of time as far as I can tell, and again, still can't reasonably get it below 700KiB, or if just going for that 42MiB mark then it'll break when the environment changes slightly again, such as a different python version or a different vm/container config is used or if another process is changed/added/removed

  • Denis_1425365 Avatar

    In tests one test repeats 3 times always, you need to fix this.If this not a feature of course)

  • Denis_1425365 Avatar

    Hello, in my opinion this is a great kata, i rejoise this one. Dont stop with this, you really good in makeing kata;))

  • rowcased Avatar

    Great kata

  • vl4deee11 Avatar

    Cool kata !!! thanks @iv2101

  • user9644768 Avatar

    Please use new python test framework.

  • FArekkusu Avatar

    No tests where the last element in the list is substituted.

  • Ching Ching Avatar

    Same kata as this one: https://www.codewars.com/kata/missing-and-duplicate-number/ except that that kata is currently in Javascript only.

  • kontic Avatar

    New katas are underrated in comparison to the old ones. This nice kata deserves at least 5_kyu, thanks.

  • siebenschlaefer Avatar

    Nice kata. Approved.

  • Blind4Basics Avatar

    DON'T USE test.expect!

    1. if you use it, provide meaningful error message, for example, providing the expected solution...
    2. if you really use it, USE AT LEAST THAT: test.expect(..., msg, allow_raise=True)

    (yes, I'm a bit exceeded because I'm at my 6th implementation and it still doesn't pass while I had now idea that my code didn't return the right answer because I had systematically a time out error... And then I investigated breaking the tests manually and ended up with that below)

    Small tests
      Test Passed
    Hard tests
      nope!      => THAT'S THE BIG JOKE OF test.expect...
      nope!
      nope!
      None should equal (63863, 244972)
    

    EDIT: Errr... You don't use test.except, actually, right? x-/ Anyway, can you explain this mess, please?