Ad
  • Custom User Avatar

    Your submitted solution is incorrent, it shouldn't have passed. I can't reproduce it now.

  • Custom User Avatar

    You lose some time with the import and use more memory by using by Numpy; also internally np.arrange performs loops and declarations so I don't know if there will be improvements. I would need to test it.

  • Custom User Avatar

    @Goncalerta: I blame the codewars viewer. That being said, cout shouldn't work without #include <iostream>. I suspect hijinks in Codewars' undocumented C++ testing framework.

  • Custom User Avatar

    good solution however to save a mod which is computationally heavy you can do np.arange(0, len(word), 2)

  • Custom User Avatar

    thanks lazy wolf

  • Custom User Avatar

    In regard to your question, Moagli, it sounds like you removed the "static" keyword from the race method.

    The tests call the "race" method from the Tortoise class itself rather than from any instance, so the method needs to remain static.

    e.g.

    static std::vector<int> race(int v1, int v2, int g)
    
  • Custom User Avatar

    I see you are new at CW but note that when you ask about your code it is not an issue of the kata but only a problem
    in your code so post it as a question. Issues make the author loss points:-(
    Moreover you can see that 56 guys passed the kata without any problem.
    BTW maybe you should learn more about C++ :-)

  • Custom User Avatar

    likely to be my fault but the class for the c++ solution is throwing me off, are we meant to declare it to include the expected result too? When I try and run an example script it says:

    -isystem /runner/frameworks/cpp error: call to non-static member function without an object argument
    testequal(Tortoise::race(v1, v2, g), expected);
    ~~~~~~~~~~^~~~
    1 error generated.

    Any help would be really great as I can program basic c++ but just struggling with the codewars interface/expectations.

  • Custom User Avatar

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