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.
I totally agree. Solving the problem should be front and center. Optimization increases the difficulty and should be a separate kata. I won't be back for sure. I already passed the first set of tests and that's enough for me.
Nice solution
I've just finished this kata using C#. I am still beginner so it took days to finished:), took many small steps to understand it because majority time I did it on side monitor while playing game on the main monitor.
Seems like there's a bug in C#. My code passed the basic test, but fail the more advanced testing. I Console.WriteLine my result and it matches the expected results, but error message still reports a difference in index values
.oooooo.
./.../.
......
.../...
.......
See my results plus exptected.
10010010
10010010
Great idea to group teams into Away and Home to simpify and shorten the algorithm.
This is fire
This code defines a Compare method that takes in two strings, line1 and line2, and compares them based on a predetermined order. The method returns a positive value if line2 should come before line1 in the order, a negative value if line1 should come before line2, and 0 if the two lines are equal.
The method begins by defining an array of strings called order, which represents the order in which the lines should be sorted. The array includes strings such as "a ", "2 ", "3 ", etc., which represent different categories of lines that should be sorted in a specific order.
Next, the method returns the difference between the indices of line2 and line1 in the order array. The indices are determined using the Array.IndexOf method, which returns the index of the first occurrence of a given value in an array. If either line1 or line2 is not found in the order array, the Array.IndexOf method returns -1.
The [..2] syntax at the end of each line indicates that the comparison should be based on the first two characters of line1 and line2, respectively. This means that the method will compare the first two characters of each line and use the predetermined order to determine which line should come first.
For example, if line1 is "a line" and line2 is "3 line", the method will return a positive value because "3 " comes before "a " in the order array. On the other hand, if line1 is "5 line" and line2 is "a line", the method will return a negative value because "a " comes before "5 " in the order array.
Wow. Just wow.
I ended up spending over an hour trying to figure out the logic only to get a timeout after submiting the code. If you use Math you can solve this with one line of code.
This is troublesome until you see the pattern (1, 11, 111, 1111) <== my hint to those who are struggling and getting hit with performance issues.
Recommendation: if you use these strings @"" there's no need to escape Regex with double-slashes.
Man, I just learned from your clever code: for (; maze[i, j] != 2; j = ++j % n, i = j > 0 ? i : ++i % n) ;
Thank you for posting
Wow, I particularly like this solution because the logic is spot on and I haven't seen this kind of approach before.
I just learned something.
:-)
Loading more items...