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.
and the check for length can be done before the loop
exactly, strange it got so many 'clever' votes.
A null input should either throw a NullPointerException (discouraged) or should gracefully delegate the null-handling back to the caller by returning null (prefered).
Converting null to an empty string (or any other "empty" object, for that matter) is a bad practice that leads to confusion in more complex code as to where exactly the unexpected "empty" dummy object originated from. An empty string is no different from any other empty object – it has no semantic value but is merely a meaningless stopgap. DON'T PRODUCE EMPTY OBJECTS!
I have not considered this yet. I believe if 2 (or more) solutions both have the shortest length, either one should be accepted, as the criteria states
"The shortest solution is the one containing the least nodes labeled 'P'."
So, they would both work. I will add this later, thanks.
For some matrices, there are multiple solutions. It's unclear how to choose between them. For example:
X S X
. X .
X G X
has two solutions with the same path length. How do you choose between them?
There is a small issue with the default test: Assert.assertEquals should be simply assertEquals.
Thanks but don't deserve an issue that are for rather big problems:-)
There's a typo in the solution template for java - ouor should be "your"
Already written :
2) The encode method should return an empty String if a null parameter is passed.
The description should mention how null input should be handled.
This doesn't work - try {'n', 'w', 'n', 'w', 'n', 'w', 'n', 'w', 'n', 'w'} as input.