Ad
  • Custom User Avatar

    Didn't help at all. I wonder, why would it help...

    Here's a line of my code to explain what I mean:

    $lyrics .= "{$count} bottle{$endingBefore} of beer on the wall, {$count} bottle{$endingBefore} of beer.\\n";
    

    As you can see, I need to expand variables, which would not be done if I enclosed my long string in single quotes.

    P.S. Finally made my solution work by ending each output line except for the last one with \\n and moving a helper function outside of the main function. Crazy...

  • Custom User Avatar

    That's quite possible. My solution is quite naive, and I did not check all the possible cases.

  • Custom User Avatar

    Hi everybody,

    For some reason, my PHP solution always fails the test when the input is '9'.
    I'm new to PHP, but the lyrics generated by my code look fine. At least, I compared my output with the expected output line by line.
    I suspect that something is wrong with my line endings, so I tried different ones: \n, \r\n, PHP_EOL, even < br > (the last one is obviously wrong), but still couldn't pass the test.
    Any ideas are welcome.

    Cheers.

  • Custom User Avatar

    Problem solved after a lot of work. :)

  • Custom User Avatar

    For some reason, I can't submit my JavaScript solution after it has passed all of the tests successfully.

    P.S. My bad, didn't see that it's "retired."

  • Custom User Avatar

    Now my JavaScript solution successfully runs through most -- but sadly not all -- of the random tests...

    Is it possible that some of the random tests are a little bit off the mark? For example, this one:

    [[41,65],[60,94],[2,24],[46,47],[70,85],[16,77],[33,86],[54,95],[72,92],[74,94],[69,81],[31,46],[63,100],[69,87],[72,97],[20,54],[71,74],[1,66],[56,72],[54,58],[8,94],[21,58],[6,23],[65,93],[41,61],[77,89],[52,57],[29,54],[68,73],[67,82],[11,63],[35,71],[64,89],[80,97],[38,95]]

    Expected: 18, instead got: 17

    If anyone is interested, I can provide my console logs indicating that the maximum number of people in the room in that particular case should be 17, not 18.

    Beware of spoilers!

    P.S. Of course, I might be wrong, but I've already manually double-checked the above-mentioned console logs.

    P.P.S. My bad, I've probably misunderstood the problem statement a little bit:

    "please note that guest still in the room at 10th minute."

    P.P.P.S. Actually it looks like I've second-guessed the problem statement when writing my code, so my offer stays.

  • Custom User Avatar

    For example, here's how much time it takes to run a very simple JavaScript function whose body consists of a single line that only returns a fixed number:

    Time: 5392ms Passed: 2 Failed: 103 Exit Code: 1

    If I add a few things like finding (but not outputting to the console) the minumum entry time, the maximum entry time, the minumum exit time, and the maximum exit time -- which would not allow me to solve this nontrivial kata but at least could give me some perspective -- the code running time goes up:

    Time: 5884ms Passed: 3 Failed: 102 Exit Code: 1

    And I have not done anything useful yet...

    P.S. Sorry, initially I mentioned Python, but it was actually JavaScript. Sometimes I mix them up. :)

    P.P.S. Hopefully, I can solve this kata on my own. But still, I believe 5 kyu is not the most appropriate grade. :)

  • Custom User Avatar

    5 kyu, you must be kidding...

  • Custom User Avatar

    Great advice! As soon as I made a copy of the input array instead of reusing it, it worked like a charm.

  • Custom User Avatar
  • Custom User Avatar

    Python

    Testing 'B' and 'WhL': should return True
    Testing 'g' and 'Xe': should return True
    Testing 'XMQSx39JnY5tI' and 'D': should return True

    Anyone?

    P.S. The random tests seem to be broken...

  • Custom User Avatar

    Hi everybody.

    I have a problem solving this seemingly trivial kata.

    For example, the input is as follows:

    [-49, -8, 431, 370, 60, 336, 292, 190, 90, 398, 208, 40, 349, 100, 275, 124, 357, 434, 304, 50, 244]

    My code produces the following output:

    [-49, -57, 374, 744, 804, 1140, 1432, 1622, 1712, 2110, 2318, 2358, 2707, 2807, 3082, 3206, 3563, 3997, 4301, 4351, 4595]

    Could anyone please tell me how the following "correct" output is obtained.

    [-49, -106, 268, 1012, 1816, 2956, 4388, 6010, 7722, 9832, 12150, 14508, 17215, 20022, 23104, 26310, 29873, 33870, 38171, 42522, 47117]

    Probably I've misunderstood the problem statement.

    Cheers.

  • Custom User Avatar

    I guess, 3 kyu would be more appropriate. My recursive solution hits the time limit. :)

  • Custom User Avatar

    I believe 4 kye would be more appropriate for this kata.

  • Custom User Avatar

    True! Somehow an undefined turned into a null. :)

  • Loading more items...