Ad
  • Custom User Avatar

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

  • Custom User Avatar
    • Damn, you're right – thanks for noticing.
    • Eh, I don't think it's critical.
    • Oh, you're correct, it is exploitable indeed. When writing large test cases, it looks like I just copy-pasted the small test parts and forgot to modify them. I just assumed something about myself that I didn't do. It's not my code to begin with; I just did some cleaning 😅

    I think it should be good now. Please review it again.

  • Custom User Avatar

    I still recommend adding something about null-terminated strings (or C-strings) to the title to avoid confusion. This kata isn't really about the general concept of strings in informatics; it's focused on a specific type of it.

  • Custom User Avatar

    I prefer to maintain const-clarity: everything intended to be constant, I explicitly declare as constant. It's a habit, much like fastening a seatbelt, 99.9% of the time, it may seem unnecessary, but that one time it matters, it can save your life. Besides, it costs nothing to just type one extra symbol.

  • Custom User Avatar

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

  • Custom User Avatar

    I did what you ask. No need for a reference solution

    Also, I increased the number of test to 500, so the probability of getting every length from 1 to 50 is ~99.8% (before it was ~0.02%).

  • Custom User Avatar

    It's 7 kyu kata, I don't think there's a need to make it more complicated than it already is

  • Custom User Avatar

    Is this a question? The short answer is probably "no".

    The long answer is that tests are specifically written to avoid 64 bit overflow, so the answer is probably "no".

  • Custom User Avatar

    You are free to do or return whatever you want inside (and sometimes even outside) of the function, as long as the function signature stays the same

    Do your magic, wizard :^)

  • Custom User Avatar

    Все тесты корректные, внимательно читай условие задачи, в частности, последний пункт.

  • Custom User Avatar
  • Custom User Avatar

    @o2001 I think while translating this specific kata to C++ it happens to be one of these cases where it would be better to just keep the signature it as is. After all, C++ does have null-terminated strings, and this kata is focused primarily on them, not strings as a concept in general.

  • Custom User Avatar

    Also, we have this kata, which is specifically made for C and descendents of C. I think if following the example and adding something about C in the title would help to avoid this problem.

  • Custom User Avatar

    Just yell at people for translating to any language that has no null-terminator and reject, as we already do with BF translations

  • Custom User Avatar

    @Wizardll o2001 alredy kindly handled all issues in his fork. Please, review it.

  • Loading more items...