Ad
  • Custom User Avatar

    That's great. I like the suggestion, but I don't know how to change the ranking.

  • Custom User Avatar

    Hi Alberto!

    Minor observation regarding the Python translation...

    The second function has a "{" instead of a ":" after the function definition. Easy to fix for the coders but it might be worth tidying up :-)

    cheers, Phil

  • Custom User Avatar

    Hi gdbaldw,

    Did you get anywhere with this?

    One thing I noticed in terms of the pattern of digits in the two solutions was that they each have a "backward L" shape within at least one district. In the case of the first solution it's in District 2, and in the second solution the backward-L appears within both District 2 and 3 (and arguably 4). By "backward L" I mean that the digits in the district move downward, and then to the left.

    When I was solving this Kata, the downwards-then-move-to-the-left was one of the last things I had to code for (as I was getting None even when a valid solution was available). My solution takes a somewhat "brute force" approach in that it first generates every possibility for what each district combination may look like (5 valid districts according to the rules) and then compares the pattern provided in the input with each generated potential solution to see if we get a "hit" of winning 3 districts.

    I can't (for unknown reasons!) see beyond the 5th line of your solution so I can't see if your code covers this backward-L scenario fully (not sure I'd understand the code even if I could see it!).

    cheers, Phil

  • Custom User Avatar

    Hi davilla!

    Well I finally managed to get around to doing this kata again, and the solution seemed a bit easier this time around (maybe I've been thinking about it in my sleep!)

    I'm not an expert in how codewars ranks its kata, but I think this one is probably worth a bit more than a "Level 5". I say that for two reasons:

    1 - The code needs to be quite strong in terms of performance. Like yourself, I had an initial solution that solved the puzzle, but it took too long when running the tests. The highest number for "n" I saw was 1474, and that combined with other potentially high numbers means that even with the faster version I have now, the code often came close to 12000ms.

    2 - The puzzle as its presented in the description is really good (I'm not sure if you're a native English speaker - I am, and I've seen some kata descriptions that are very hard to understand. This one is excellent however!) but the puzzle in itself is a bit tricky to solve, I think. I mean, if you had real dominoes in front of you and someone asked you to make a valid Train out of them, it isn't all that simple. So there's a challenge in even thinking up a method to create a valid train.

    In any case, even if this remains a Level 5 kata, I have to say I really enjoyed it and learned some important new ideas in terms of Python coding, so my sincere thanks to you and to everyone else involved in the creation and development of this kata!

    Merci beaucoup as they say en France!!

    cheers, Phil

  • Custom User Avatar

    For me default version is 3.6. Maybe something hasn't updated/refreshed properly, so 2.7 turned up for you instead ¯\_(ツ)_/¯

  • Custom User Avatar

    Done. I've set the default versin to 3.6, but when I go to the trainer, 2.7 shows up. Any way I can get this to stick?

  • Custom User Avatar

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

  • Custom User Avatar

    The reference solution in C should be made static.

  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    Python 3 should have been set as a default version, but that's not a big problem.

  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    Moved to test fixture.

  • Custom User Avatar

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

  • Loading more items...