Ad
  • Custom User Avatar

    This kata made me RTFM and learn about classes and dunders in Python :D

  • Custom User Avatar

    it just looks funny to me :)

  • Custom User Avatar

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

  • Custom User Avatar

    Don't know what're you talking about, kata seems fine for me. I would add "don't use strings" as an additional requirement (That is what people do in similar python katas)

  • Custom User Avatar

    Don't know what you're talking about, kata seems good enough for me. I would add "don't use strings" as they do for similar python katas :)

  • Custom User Avatar

    Thanks for you comment! I used static cast to explicitly show that it will be int. As far as I know it has no impact during runtime, i.e. check performed only during compilation.
    As for lambda, I use it in C# a lot, but C++ is a mishmash on its own, so this was again for clarity reasons. Besides I don't have a foggiest idea how lamda works in C++ "under the hood" :)

  • Custom User Avatar

    Awesome kata! Thanks g964!

    It seems comparing my own solution against other's makes the biggest difference for me!
    I spend almost equal time to solving AND tracking other solutions!
    And had to tackle std::chrono to find out if there are any performance boost at all :D

  • Custom User Avatar

    Hi!
    Put character into single quotation marks, like this '*'.
    Then compiler will count it as single char.
    Double quotation marks, like this "*", means that you have a C-string char* containing 1 symbol.

  • Custom User Avatar

    Me too. All heil to the commented snippets! :)

  • Custom User Avatar

    Cool kata, I enjoy it very much! Thank you!

    Btw, I think if you want to enforce people not to modify array parameter, you might consider to declare it as const.
    Tho nobody prevents the coder to modify arguments while solving the kata :D

  • Custom User Avatar

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

  • Custom User Avatar

    Hi there! It seems there is a roudning bug either in my code or test case, in particular the test that gives "104" as a result.
    In my solution I've explained it right next to the line that helps to overcome the bug.

    Can someone point out what I did wrong? Thanks :)

  • Custom User Avatar

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

  • Custom User Avatar

    Cool task!
    Spent almost 2 hours to solve this one in C++ (which is terribly slow I guess), but now I have a firm grip on <algorithm> and <numeric>! Or at least now I know what they are for :D
    Took me a while to wrap my head around the description tho.
    Nevertheless, g964 you have my gratitude!