Ad
  • Custom User Avatar

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

  • Custom User Avatar

    I actually solved it using my solution. the problem was that i was erroneusly using pointers on slices. i studied more how golang passes slices and what's actually the "value" passed between functions. this would make an unstable behavior of the code. still i haven't figured out why locally it was constantly passing everything. solved by just removing pointers.

    I really thank you for your quick responses. this was really a my bad.

  • Custom User Avatar

    You can try one (or all) of following:

    • Post your code here so someone could check it (remember about code formatting and use Spoiler flag).
    • Make sure that you use the same version of Go on your local machine and on Codewars (which is 1.20).
    • Join Codewars Discord and post a question in #help-solve channel. It might be easier to find someone to help there.
  • Custom User Avatar

    i don't get it, i'm currently printing the solution with your tests, multiple times, i keep getting the right answer (9) locally. my code seems to keep working after changing the order of the inputs. could i share the code somehow without having
    to spoiler others?

  • Custom User Avatar

    Your solution seems to not be correct, it behaves in a stange way for following test cases:

    Expect(SumOfIntervals([][2]int{{1, 5}, {6, 11}})).To(Equal(9))  // your solution returns 5
    Expect(SumOfIntervals([][2]int{{6, 11}, {1, 5}})).To(Equal(9))  // your solution returns 4
    

    Your solution returns different answers for the same set of intervals, given in different order.

  • Custom User Avatar

    Your solution not passing tests is not a kata issue.

  • Custom User Avatar

    i feel like my code works fine, yet i cannot pass any test here. copied all the tests i saw in the comments and the onse in the problem details and it work for me. i don't get it, i don't have the problem of swapping the intervals. plus i printed the inputs and locally it still get the expected value. yet running it here won't work

  • Custom User Avatar

    No worries, best of luck with your other katas and solutions!

  • Custom User Avatar

    Yeah, it took reading over it 15 times, but i finally realised my mistake, Just a downside of dyslexia...

  • Custom User Avatar
    #snruter a but or or five but sekat the name Kata one gnirts but secaps only of a dedulcni word gnirts dessap dedulcni when
                                  |||||
    #snruter a but or or five but takes the name Kata one gnirts but secaps only of a dedulcni word gnirts dessap dedulcni when
    

    Are you 100% sure you've tested the edge case where the word length is equal to 5?

  • Custom User Avatar

    This comment has been deleted.

  • Custom User Avatar

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

  • Custom User Avatar

    Yes, good catch! You can utilize 2 pointer technique for that, but since this kata does not focus much on optimziation and performance, most people will just go along with a more straightforward solutions which typically involve iterating through the string more than once :(

  • Custom User Avatar

    Rejected by someone

  • Custom User Avatar
  • Loading more items...