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 fixed it in a new fork, though maintaining the right order
Expect(expected).To(Equal(actual))
in the tests (otherwise the message seems contradictory, at least it's how all katas tests are set).That should cover the common error, but if a test was added in the sample tests it would be fine by me. Or adding this example to the description:
10 = 10 therefore it is a draw
You first minimize
i
then minimizej
. There is an order to the operation involved. Otherwise why are they listed in an ordered list?Also,
Have you looked at the dozens of comments from other people
is an invalid argument because there are always clueless people who raise bogus issues on even8kyu
s that has no problems because they didn't bother reading the descriptions and blame everything as someone else's fault. In fact I can pull several extreme examples immediately:https://www.codewars.com/kata/sum-of-digits-slash-digital-root/discuss
https://www.codewars.com/kata/persistent-bugger/discuss
https://www.codewars.com/kata/good-vs-evil/discuss
I don't have problems because I do look at descriptions and when I get failed tests, I review my code and see why I'm wrong (emphasis I, I don't blame the kata for anything unless it's proven to be the kata's fault). If you're blaming the kata and the kata author for everything regardless of their correctness, you're causing more trouble for its worth.
(Also, no, requiring
i
to be smallest is not stupid at all because that's the only way to guaranteed the uniqueness of the solution. If you're thinking otherwise you're stupid. Please reflect more on yourself.)This comment is hidden because it contains spoiler information about the solution
Yes, you have a point. If this Kata had a performance version a different approach would be required.
As I was saying, many lines aren't used:
The rest is interesting, otherwise I would not have forked your solution but published a new one.
I also did change the logic a bit.
adjectives
andnouns
are sets: by iterating on them with a nested loop, you have actually lost their main advantage, a constant time look up operation.At worst, you read all the sets in order to check if
split_word
is inside whereas you can just usein
operator.In addition, using
replace
to get rid of suffix can be wrong if a word begins with this suffix.Also note that slicing is faster that replacing end of a word.
This comment is hidden because it contains spoiler information about the solution