Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
That's great. I like the suggestion, but I don't know how to change the ranking.
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
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
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
For me default version is
3.6
. Maybe something hasn't updated/refreshed properly, so2.7
turned up for you instead ¯\_(ツ)_/¯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?
This comment is hidden because it contains spoiler information about the solution
The reference solution in C should be made
static
.This comment is hidden because it contains spoiler information about the solution
Python 3 should have been set as a default version, but that's not a big problem.
This comment is hidden because it contains spoiler information about the solution
Moved to test fixture.
This comment is hidden because it contains spoiler information about the solution
Loading more items...