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.
Because the description specifies a tiebreaker for identical score differences.
is
num
a string?keep getting error that num.split('') is not a function ofr javascript. I know it should be working
I'd personaly have return 0: "If more than one valid result, return the smallest index."
They all have a score difference of 1, so why not take the smallest index ?
You are right, the best match is the 5th one. But you should return the index, which is 4 in this case.
Oops, fixed :)
You've written a2 instead of a1 at the end of the first sentence.
I've updated the description so hopefully it makes things clearer.
See the first letter of the animals of a1 and the output arrays
In the examples, I don't understand how the return is influenced by 'a1'. Can someone please clarify what they are being sorted based on?
I'm having the same problem
I am a bit confused while trying this on ruby -- third sample test:
Test.assert_equals(best_match([1, 2, 3, 4, 5],[0, 1, 2, 3, 4]),4)
Shouldn't the return be 5 rather than 4? Because 1-0, 2-1, 3-2, 4-3 and 5 - 4 all = 1 , and weren't more points scored in the 5th match rather than the 4th?? What am I missing?
That's the only test that is failing for me - others with a similar scenario come through as correct.
Thanks guys, I was ablet to figure out that it wasn't quite working correctly with capital letters from your comments.
Test.assert_equals(duplicate_encode('Test'), ')(()')
Don`t use each_char. Use .split("").each
Loading more items...