Ad
  • Custom User Avatar

    Hi patrick :) I solved your kata and I was thinking it would be even better if you add some random test cases cause now some users could just hard code their values in the function and succeed.

  • Custom User Avatar

    Thanks for pointing that out, I've updated the description accordingly. I chose to exclude the end of ranges for practical reasons.

  • Custom User Avatar

    Nice kata - an interesting real world problem, and the test cases are well set up. I am so pleased with myself for finishing it (without looking it up)!

  • Custom User Avatar

    Yeah ) Still, excluding the end of a range of discrete values is usually more convenient. It should probably be explicitly stated in the description, though.

  • Custom User Avatar

    regarding the test case:

    checkAvailability([["09:30", "10:15"], ["12:20", "15:50"]], "10:15") => true

    In my experience, any meeting scheduled to finish at 10:15, say, would most often not have finished at that time :)

  • Custom User Avatar

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

  • Custom User Avatar

    Neat use of join(). I am just wondering if ((i<<1)-1) might be faster generally as well as marginally less code than ((i-1)*2+1).

  • Custom User Avatar

    I am aware that my solution passes the original tests. It also passes the two extra tests I mention in my question.

    My problem is that the "best practices" solution (ColbyDauph,alexcaza et al) does not pass the two new tests.

    Is there something wrong with the tests? They seem logical to me.
       Thank you for helping with this btw.

  • Custom User Avatar

    Your solution seems just fine, it passes all tests when I submit it. Please try again later - sometimes codewars engine fails. It happens very rarely though.

    Please try to submit again.

  • Custom User Avatar

    Help please.

    If I complete the set of tests with:

    Test.assertEquals(dog_dont_bark_by_default(true), SLEEP, 'Should NOT bark if told so');

    and

    Test.assertEquals(dog_bark_by_default(true), BARK, 'Should bark by default');

    the accepted solution fails these tests.

  • Custom User Avatar

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