Ad
  • Custom User Avatar

    In theory those solutions should get invalidated when someone next pushes changes to the Python test suite, but those runner jobs do seem to sometimes just vanish into the ether.

  • Custom User Avatar

    you were right!

    i did change now my old version, thx to you're comment.
    just by moving the ships variable into the function and use "global ships" its now a working solution too. and pretty similar to my code with the class

  • Custom User Avatar

    yes. i ran into the same problem. there is something wrong with the random tests for Python.

    solution:
    changed functions based code into class

    a class always makes a new instance for all atributes (variables), this solved the issue and passed it!
    after long long time looking whats wrong with my code...

    looks like the random tests do not clear all data and keep randomly data from the previous test...

  • Custom User Avatar

    For years, the Python version of this kata only has 12 fixed tests and doesn't have any random test.

    Recently, additional random tests were added.

    That's why some less efficient solutions that used to pass will timeout.

  • Default User Avatar

    There's a lot to answer here but, briefly:

    • on old katas, you may be seeing code that dates back almost 10 years; corresponding to different language versions (in Python, many old solution are in Python 2 for example)

    • the performance of the code runner on Codewars can change (but generally the mods/admins will check katas to make sure that they can still be completed)

    • in some cases, users and mods will upgrade tests to katas that were "too simple" (i.e. if they allowed simple brute force solutions to pass), but this will always be done making sure the kata can still be completed within the time limit

    In your case; the code you show above contains a few inefficiencies - now that you have found a working solution, it would be a good learning experience to re-read your old approach and work out why it was so slow (it has to do with the data structure you were using).

  • Default User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    At other Kata, i had trouble with:
    i finaly did it, i checked solutions, wondering why those worked and my former version didn't.
    turned out: some solutions did NOT work. got timeout.

    Someone wrote the preformance tests changed, by Codewars, over the years.

    could it be that it happend here too? changes of Codewars test made it hardly possible to finish now?

  • Default User Avatar

    I haven't been on Codewars for long enough to be 100% sure, but I've read that the performance of the Python code runner has changed over the years.

    You may be right therefore: this kata is almost 10 years old, so some of the solutions may correspond to older versions of Codewars or even Python itself.

  • Custom User Avatar

    I DID IT!!!

    was quite some work to get it done... passed the last 100000 test in time, but had trouble to find a solution for the 1.000.000.

    so i was looking at other solutions, tried others out... looking at the
    and found solutions that didn't pass the attempt.

    are those old once, and test got changed?

  • Custom User Avatar

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

  • Custom User Avatar

    Can you provide more information here? The examples and details on the Kata explain from the get-go the types of cases that will appear, as well as the fact that there will be a need to write an efficient algorithm due to the requirement of having to handle lists with 10 million elements.

  • Custom User Avatar

    okay... this is the worst Kata im doing sofar.
    why?
    The very first test on Attempt, is ment to kill your code, without a way to figure out why.
    I belive thats on purpose. It's not a good learning experience.

    maybe the kyu 5 is wrong? Im kyu 6.

    atleast i learned to aboard the code in a way so i get some info on the attempt-test. thank you.

    but same as others wrote here:
    it feels like cheating, to solve this kata. i don't think that is ment for beginners.