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.
2*n == n*2
Yours seems slightly faster indeed, but around 10-20% depending on the size of the list.
And partly because of the extra layer of itemgetter.
For example with the same random tests as the kata and the same list of 1_000_000 tests for each one, I get the following results:
Mercy: 3.399389314651489 seconds
Oleg: 3.032890796661377 seconds
rowcased: 3.238804864883423 seconds
And while obviously not unreadable, your code takes just a little longer to get for a newcomer.
You're right, maybe I should have done that. Here's some examples:
Rastarwe Astaregil passes the test, as it contains 'astar' in the surname. Same with Ethiron Eastarwe.
Dontegiliel Garthenwe and Oltegilion Iastwe also both pass the test, as their first names contain 'tegil'
Rossion Aelhan, Ollrion Mornriel and Dierar Agareth do not pass the test; their first names don't contain 'tegil' and their surnames don't contain 'astar'.
Agarriel Tegilwen doesn't pass either; his surname contains 'tegil', but we only want that in the first name.
I've revised the description, I hope it's clearer now. Thanks!
yes it would
i agree with what has been said and ill keep that in mind next time. But also to make it faster, could you also add a break right after you add the element into the set. Because elements in a1 needs to be a substring of at least one of the elements in a2, wouldnt it be best to cut off the for-loop and go on with the next word in a1?
im new to coding and im curious, i like to make my code as optimal as possible :)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
And about n times less memory.
This comment is hidden because it contains spoiler information about the solution
how?
@unnamed, if there is a bug in the ref soln, pls do tell. I didn't understand your post.
Thanks.
The reference solution calls user's solution, so there's a bug indeed, but it affects only incorrect solutions. Your solution fails at
Test.assert_equals(solve('i', 'i'), 1)
.Edge case tests with empty and 1-letter strings should be added.
Only admins can change kata ranking (if), so don't keep your hopes up.
Loading more items...