Ad
  • Default User Avatar
  • Default User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    I both love and hate seeing an arrow function leading to a less than or equal to. It's like two arrows pointing to the same variable.

  • Custom User Avatar

    New to ruby, is that forbidden? Weird that it makes the random tests fail but not the others.

  • Custom User Avatar

    Ruby version is working correctly. And you're most probably mutating the input.

  • Custom User Avatar

    Ruby random tests verification uses the same value for target and start. But the function is fed different values (Same issue reported by @sergeyn 3 years ago).

    Rand test 1
    start = [7, 7]
    target = [0, 5]

    wrong route from [0, 5] to [0, 5] - Expected: [[0, 5]], instead got: [[7, 7], [6, 6], [5, 5], [4, 5], [3, 5], [2, 5], [1, 5], [0, 5]]

  • Default User Avatar

    I wrote this solution. I can tell you it breaks two tenets of javascript best practices of old: (1) avoid the comma operator and (2) always delimit blocks with curly braces. Whether these are still as relevant now as they were then is debatable.

    I've always held that the comma operator has its place in loop conditions. You should get acquainted with it. But in this case it's the wrong tool for the job. I've virtually never used it before, but I think this is a case for the do ... while loop.

  • Custom User Avatar

    Is this while loop really "Best Practices"? Made me scratch my head for a while.

  • Custom User Avatar

    Thanks that worked! It seems my solution was just a little bit too slow with 10 long string random tests total.

    What's weird is that I now see many solutions using array methods. I tried the first two higest rated ones and they time out too.
    I guess the server was a bit slower today.

  • Custom User Avatar

    Try using for loops instead of split + foreach. There are better ways of doing it too, but that should work.

  • Custom User Avatar

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

  • Custom User Avatar

    There are many different kinds of parser problems, and this one is not those ones worthy of being a blue kata. This one doesn't even have precedence rules, and yes, even a slightly complicated regex will work very fine.

    Elephant in the room: there are many possible difficulties to a parser, which all depends on the grammar. Not anything marked "parser" is automatically "very hard". Please put up some better arguments next time before asking me why I downranked some particular katas ;-) I expected better from all of you.

    Voile is crazy with parsers

    Yes (if anyone can plug in a parser combinator library and finish all of them with just the slightest variations required, they're not very good katas), but irrelevant to this kata. I downranked it because it really isn't hard.


    Resolving because OP is basically saying the old "everything I can't solve is 1kyu, can you re-ranking it to such?", which is not a good judgement on the kata rank.

  • Default User Avatar

    the funny thing is that upranking isn't possible either...

  • Default User Avatar

    @FArekkusu :

    You should probably ask Voile for the reasons and not me. Though the Kata was a lil over ranked anyway. 4Kyu would have been better (after random tests)

    Following the same logic we should downrank Simple Interactive Interpreter from 1 kyu to 8 kyu because it has only 15 fixed tests :+1:

    :+1:, Well no more down-ranking is possible now, so :(

    You could always ask admins to do it. :)

  • Loading more items...