Ad
  • Custom User Avatar

    I'd guess that the reason is you can't get much faster than just int * with a manually written algorithm for multiplication. The base conversion into binary (internal representation of int) was the slow part for add. Maybe should test it out.

  • Custom User Avatar

    Because the kata was originally about writing algorithms which manually multiply very large numbers. In Python, numbers can get as big as you want, so solving this would be as simple as

    def multiply(a, b):
        return str(int(a) * int(b))
    

    Which is neither interesting, nor worthy of a 4kyu rank.

  • Custom User Avatar

    This kata doesn't make sense for languages with native BigInt support (even though there's translations for languages that do support BigInt, in the future, I think they will be removed).

  • Custom User Avatar

    Fixed C++ sample tests.

  • Custom User Avatar

    Actually, I agree...

  • Custom User Avatar
  • Custom User Avatar

    So this function should return the first pair of two prime numbers spaced with a gap of g between the limits m, n if these numbers exist otherwise `nil or null or None or Nothing (or ... depending on the language).

    That should return nil, null, None or Nothing

  • Default User Avatar

    Sorry: I don't see such a case (C++ ?).

  • Custom User Avatar

    How do you C++ people debug such things?

    Simple: we switch to Java or C#.

    I want to prepare myself for real-world C++ with Codewars. Any additional hints are welcome.

    Switch to Java or C# :trollface:

  • Default User Avatar

    Question resolved.

  • Custom User Avatar

    Where did std::unique() in Visual Studio come from when I did not #include ?

    One can't know. If not requested explicitly, it could come into scope by some indirect includes, or in some other way, and it's difficult to find out what it actually is and where from.

    What did that version of std::unique() do? Obviously something different.

    Since one cannot tell what exactly it is, it's difficult to tell what it actually does.

    Where did std::unique in CodeWars come from when I didn't #include ?

    See both of above.

    Can we change that so we get a compiler error?

    Unfortunately, not.

    Botom line is, when you want to use std::unique (or any other name, for that matter), you need to explicitly include headers which provide its declaration. If you attempt to use it but you do not include it, it's an error on your side and strange things may happen.

  • Custom User Avatar

    Maybe you didn't get something well: in Codewars, for each kata there are basic tests, and attempt tests. Basic test are very easy ones, passing them is not a guarantee to have actually really solved the kata. In many cases it is not. Solving a kata means your code is able to pass tests generally much harder and much complete than the basic ones, with edge cases and sometimes performance requirements. Maybe you should read this: https://docs.codewars.com/training/troubleshooting/

  • Default User Avatar

    small correction to your issue.

    The test cases already have it.

    On the other hand, sample tests dont. So if someone wants to edit that in, go for it.

  • Custom User Avatar

    My bad, I've messed up my tabs and checked another kata... You're (both) right.

  • Custom User Avatar

    I am not sure how you verified the report, but c++ translation seems to be a mess. it has wrong includes, missing includes, and tests indeed rely on the fact that solution introduces required names.

    it needs to be raised as an issue and fixed.

  • Loading more items...