Ad
  • Custom User Avatar

    It only shows up in "Past solutions" if you already hit Attempt and it was successfully passed all the tests.

    However, you only need to press test/attempt button and your code will be saved locally when you enter the trainer again. If you don't, and navigate elsewhere, your code gets lost.

  • Custom User Avatar

    It didn't - it's still there in "Past Solutions", when you go back to the task.

  • Custom User Avatar

    WHERE ARE THE SOLUTIONS?????

  • Custom User Avatar

    Thanks for the tips, I will look into the issues this evening.

  • Custom User Avatar

    Well, you chose C for this task, so any pain is warranted :P

    With C it's important to read comments/description to see how you should present the result.

    I only took a quick peek at your solution (after spending significant time myself trying to solve it, and suffering), and I noticed that you're assuming result is null-terminated at the beginning. It probably isn't, and contains garbage value, so when you try to concatenate another string, the result is not what you'd expect. There are probably other mistakes which I didn't investigate (for example, do you really need to copy the input sentence? What if it's longer than your number?)

    You can also make use of functions like printf to show intermediate values and help you debug the solution.

  • Default User Avatar

    And just keep in mind you are fully responsible for the memory management of *results to ge the right results.

  • Custom User Avatar

    In C it's so painful.
    Hint: The bash terminal might tell you that you're right, but the testing probably will not.
    Don't waste time in compiling using a terminal and use the Codewars text editor instead. Terminal output most of the time doesnt mean anything.
    I'm still trying to fix the result getting random characters at the end, even tho the terminal output is 100% correct.

  • Custom User Avatar

    I feel like the overlap vs adjacent numbers should be explained better. It took me a minute to realize something like (1,4) and (5,7) doesn't become (1,7). I know it's small but it's still a little annoying not having it explicitly spelled out.

  • Custom User Avatar

    Hmm... I don't like this kata.

  • Custom User Avatar

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

  • Custom User Avatar

    You're right, everything overlaps, so you end with a unique interval [1, 20], which length is 19.

  • Custom User Avatar

    all 3 others overlap each other so it's like [1, 11], which gives 10 as well.

    But you already used number 10 in the previous intervals (so, only 9 for those)

  • Custom User Avatar

    after looking on the instructions I don't get how this case should equal 19

    sumIntervals( [
       [1, 5],
       [10, 20],
       [1, 6],
       [16, 19],
       [5, 11]
    ] ) => 19
    

    which ones overlap each other here?

    Clearly, [10, 20] and [16, 19] overlapping one another. So it gives, 10.

    To me, all 3 others overlap each other so it's like [1, 11], which gives 10 as well.

    As a result, shouldn't I get 20 here?

    Skipping this one for now.

  • Custom User Avatar

    Appreciate the way you the question was structured, recovering from burn out and this was a great refresher.

  • Custom User Avatar
  • Loading more items...