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 actually have no idea of what to do with random test cases. It seems there is many many many non-alpha character that should be delim, and I don't know what to do.
Quite frustrating... Wish someone's help.
My code is written in Haskell.
One should implement its own
argmax
.Edited: Oh! One could do
reverse
beforewords
.This code is in fact not correct, because
maximumBy
will not return the first element with highest score but the final one.For example, if we use the test "ab ba" (which should return "ab"), the code cannot pass.
Get it! I'll keep an eye on it :-).
Thanks for your quick reply! Maybe I should take some time to get more familiar with codewars community. It seems to me that codewars does not give a strong suggestion for users to write efficient code, for I haven't seen statistics about time & memory usage (about others' code)... (Maybe I could upgrade to red).
Back to this problem, I still think that algorithm design should stick to the problem itself. The impact caused by the input seems to be not so relevent to me though... (Although the private timer could not measure it as you have said :-))..
And I really appreciate your idea that we could "streamize" the array to accelerate the code.
Thanks again!
Binary Search!!!
Why shouldn't we use binary search? I haven't seen a sample code with it.
Accumulating or iterating all items does not seem to be efficent...