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.
Not an issue. The string length is the same, but using diagonals, the path length is bigger.
That's exactly what the specification is saying, though:
The specification says that where there are multiple valid paths return any of them. Nothing is mentioned about preferring straight lines over diagonals.
After completing this, I get the following:
Test Failed
String lengths are both 11. Strings differ at index 4.
Expected: ".S.\n.P.\n.G."
But was: ".S.\nP..\n.G."
When formatting, this amounts to the following:
Instead of
.S.
.P.
.G.
My code returns
.S.
P..
.G.
Which afaict should be valid?
:O everything is about maintainability! :P
That doesn't matter. Just passing the test matters.
Absolutely, I see the bug now. Thank you for pointing this out. However, the instruction containing 0.55 when code only accepts ints is misleading.
26 letters in English alphabet. Why not return early if the letter is not present?
Ah, I missed that you missed W.
Your solution has a bug, it fails following test case:
[TestCase(new [] {2, 1, 2}, ExpectedResult = 1)]
.While you are right that not presenting inputs is not a good thing, you can still
Console.WriteLine
them yourself. You owuld see that your solution fails for arrays where the unique number is on the second position.Bugs in your solution are not a kata issue.
This comment is hidden because it contains spoiler information about the solution
Missed multiple opportunities to return early. The OK variable doesn't need to exist.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Also, your list of characters to split on is not that scalable. That'd be best in a collection of some kind.
This comment is hidden because it contains spoiler information about the solution