Ad
  • Custom User Avatar

    The famous C++'s "Unsafe memory" ))

  • Custom User Avatar

    I'd try to reproduce it locally, at the very least you should be able to find out what inputs it happens for by printing (and flushing to ensure it isn't stuck in a buffer) and probably throw ASan or similar at it to see if it notices anything. Of course, it might be something unexpected going on in the test code that you can't reproduce yourself - for which I suppose very carefully finding out how your function should behave is a start.

    When i run your code against the tests and print out the indata, it turns out it does happen for an obviously special test case, so there's a good chance you don't need to dig any further than that.

  • Custom User Avatar

    That may be subjecive, but given that there are mentions in description of constraints that include arrays of length ~100_000, that in itself should suggest "performance".

  • Custom User Avatar

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

  • Custom User Avatar

    What you're trying to do is input probing and doesn't make a lot of sense. What I'm understanding is you're trying to return a certain result based on a very specific input, but you're not taking into account the other argument, k. If k is negative, then the same string vector can yield back "" from your solution, and, likewise, it should return "wlwsasphmxxowiaxujylentrklctozmymu" if k is 2. Regardless, the answer you have so far is correct regardless as you've noticed.

  • Custom User Avatar

    We need to see your code to tel you what is wrong with it.

  • Custom User Avatar

    Not a kata issue.

  • Custom User Avatar

    Not an issue, and not language specific. The translation was created by the Kata author themselves, and all translations I've looked at test for the empty string. The author is probably practicing some sort of vacuous truth - dealing with 0 substrings yields back 0 substrings, or an empty string in other words. You'll see this is a lot on Codewars; a lot of Kata make sure to test an empty input unless explicitly stated otherwise.

  • Custom User Avatar

    Oh, why would that be?

  • Custom User Avatar
  • Custom User Avatar

    yes,of course you can everyone has the road to solve it, so it has a 10000 trick to solve it;

  • Custom User Avatar

    Yep, there are no high performance requirements

  • Custom User Avatar

    Sorry, I may have misread your code (this would be less likely to happen if you use proper markdown tags for readability, see there); however your first loop condition is weird for the same reason I have pointed out before. You should print stuff to see where your code is failing : https://docs.codewars.com/training/troubleshooting/

  • Custom User Avatar

    size_t will always be non negative ;)