Ad
  • Default User Avatar

    Fastest one. Could be faster when used with stringstream, but much more to write. GJ.

  • Default User Avatar

    Same problem as all the other users that upvoted here. Could you please do something about the problem?

  • Default User Avatar

    This solution is wrong. I know that. Somehow I clicked on submit as a random solution by accident worked out. :(
    Was still working on it.

  • Default User Avatar

    Thanks a lot for your encouragements!

  • Default User Avatar

    I just wanted to leave a big thank you to the author (g964) for all his great C++ Kata's on number theory.
    I learned quite a lot from them in coding as well as in math.

  • Default User Avatar

    My check if a number is prime is exactly one line long and I have no timeout.
    What you have to do to get a timeout in this is just beyond me.

  • Default User Avatar

    I try to solve all katas below 6 kyu in one line that is why I came up with this.

  • Default User Avatar

    generally good direction, but you will never write such things in the product code

  • Default User Avatar

    Ah somehow in my solution the const was gone. I must have deleted it in my code. It is a bit strange that it is in my comment and I overlooked it.
    With the const I have no problem with it. Sorry to bother you.

  • Default User Avatar

    It's a const reference, which can be bound to pretty much everything (const/non-const, lvalue/rvalue). If you want to modify the temporary string then you may choose to accept it by value without breaking anything, but I don't think this should be default.

  • Default User Avatar

    First I wanted to thank you for this kata its really interesting and I learned some cool stuff about factorials.
    (Especially I have never thought about: "factorial number system provides a unique representation for each natural number"- which is nice. ;))

    I have one suggestions for C++. The parameter in the starting definition of factString2Dec:
    static long long factString2Dec(const std::string &str);

    is passed by reference (&str), but in your testcases you give const char pointers to the function, this obviously does not work since you cannot modify them.

  • Default User Avatar

    There is no documentation about the class Route that is apparently used.
    I cannot access any of Route's data since I do not know how to access it.
    I tried iterators, [] operators and different combinations of member function names as well as member variables to get to the data.
    There is no way to guess this.

    Also there is a bug in the function template to start from since it has string as return value for the function with the std:: missing.

    Could you please tell me how to access Route? Or even better remove the shitty class and use a std::pair<std::string, std::string> or sth similar.

  • Default User Avatar

    (C++) I also do not get it. According to the Note you should not make a copy of arr, but also not modify it.
    I went through the first 15 solutions and there was not one solution that does not copy arr or sort arr itself in some way.
    This is really misleading. The solution is definitely not kyu 7 if the note is followed.

  • Default User Avatar

    I did not know that one can use boost in this task or in CW at all.
    I actually learned this from this solution.
    Seriously, this just defiles the whole problem as there is next to no mathematical thinking involved at all in using this predefined function.
    Nevertheless quite clever to use boost.