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.
Reading is a lost art ..
Sorry I could only upvote your comment once Cito.
really nicer and more readable, yes. :)
Still prefer the one-liner, especially the new version with fat arrows: http://www.codewars.com/kata/reviews/54be2a15518b8dcff90001f2/groups/56fc240e4504004e510009dd
It's less readable because you put the function decs on new lines, which I've never seen before and don't think anybody actually does. The code itself is still not great as using arbitrary names such as "v" and "w" don't give you any hints about what the code actually does.
Also, best practice should definitely include how the code is presented. Code that can be passed around from colleage to colleage and be quickly understood by everyone should be something you're looking to achieve, i.e. it should be part of the best practice.
Very interesting. Not sure why your random tests are passing while mine are not. If I am reading my output correctly, my code seems to be returning the correct response while the randomized tests seem to expect an incorrect response. Thanks for checking it out.
I saw your link. Below a small part of what I got with trying once more:
Please have a look at this screenshot: http://i.imgur.com/xUvzsUb.png
In every test case the correct answer is
-1
which is what my code is returning. However, the test cases expect a different result.I repeat myself:
I tested the random tests too as everybody passing the kata did and I had verified that a test returns
-1
in this case.I don't understand why you got 26.
The "solution" in the random tests returns
-1
for the example you gave in your previous post:[ 'ttffdddooo', 'bbbtttthhhnnnny', 'hhkkkww', 'jlllh', 'jjccccaaaazzzztttqqqwwqqqq' ] [] --> -1
Thanks for replying. Does it sound like I correctly understand what this kata is asking for? If I do, then the random test cases are incorrect and should be checked. If you look at the output that I pasted in - given that the second array is empty - the correct result should be
-1
however, the test is expecting it to be26
.Sorry of not having answered sooner but I just saw your post. If it is JS, 55 CW passed the kata without problem. I tried the kata once more and the expected result is
-1
when one of the arrays is empty.De rien, monsieur :)
You are right, I cut it too short! Corrected. Thanks Giacomo!
Ruby example test case is missing the .assert_equals, it seems.
Btw, pretty good kata and glad to see Raul is considering JS too :)
I find the instructions very confusing. After experimenting with your test cases it seems like you are asking the user to find the smallest and largest string lengths in each array. If the smallest length is in the first array, subtract the largest length from the second array and return the absolute value. Otherwise take the largest length from the first array and subtract the smallest length from the second array and, again, return the absolute value.
Is this correct?
Edit:
It seems some of the random tests (in Javascript) are wrong. The instructions say if either arrays are empty it should return
-1
. When I log the arguments provided I see several tests with empty arrays. My code returns-1
in all cases but the tests are expecting a postive numerical result.Example:
Mh, checked into it and found nothing in my code (which also passes the default tests), but I did some edit to be extra sure; can you try again and then possibly comment under my own comment down below (I could not get notified otherwise)?
Thanks for your feed in the meantime :)
Loading more items...