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.
Be aware that the stack space here can become huge for bigints. It's a better practice to use tail recursion for constant stack space.
Offtopic, but: why do you copy other users' solutions? Or is this your second account?
really 🤣🤣🤣
o
->{"o": ["only"]}
-> 1 letter prefix, 1 word -> 1 = 1 -> OKa
->{"a": ["are","answers]}
-> 1 letter prefix, 2 words -> 1 < 2 -> we will add more letters to make subdivisionsar
->{"ar": ["are"]}
-> 2 letters prefix, 1 word -> 2 > 1 -> Not OKan
->{"an": ["answers"]}
-> 2 letters prefix, 1 word -> 2 > 1 -> Not OKs
->{"s": ["some","solutions]}
-> 1 letter prefix, 2 words -> 1 < 2 -> we will add more letters to make subdivisionsso
->{"so": ["some","solutions]}
-> 2 letter prefix, 2 words -> 2 = 2 -> OK["only", "solutions", "some"]
only -> beginning = o (1 letter, 1 word) OK \\\ Why 'o'? Its only one word here wtf??
are -> beginning = ar (2 letters, 1 word) not OK \\\ Why 'ar'? Its only one word here wtf??
answers -> beginning = an (2 letters, 1 word) not OK \\\ Why 'an'? Its only one word here wtf??
Whats the logic here? Why dont author explain this in the description..
thanks
Because of the the ascii values of 'l'(108) and 'm'(109). If you sort a list with these strings it will arrange words that start with the same characters by the next. In "solutions" and "some" - 's' and 'o' have the same value, it's the following characters that make the difference.
Why the ouput ["only", "solutions", "some"] insted of ["only","some","solutions"].The test: "only some solutions are answers"
ONLY if their group size (or array length) is equal to the number of shared letters in each beginning
Why the output is
["only", "solutions", "some"] instead of ["solutions', "some"]
The test:
"only some solutions are answers"
Descriptions says: Group them by their beginning!
Thank you for the remport, I change the ref solution (it was very slow endeed). Now it shouldn't timeout.
Python: The reference solution is really slow. If I run it against itself, I get a timeout. I don't think the ref solution should timeout.
I fixed the description. Thank you for the report
The description says to return an empty list if any cases match, I assume you meant if none of them match?
Loading more items...