5 kyu
[St]arting [St]ring
72 of 92carlos.vl
Loading description...
Strings
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Why the ouput ["only", "solutions", "some"] insted of ["only","some","solutions"].The test: "only some solutions are answers"
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.
thanks
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!
ONLY if their group size (or array length) is equal to the number of shared letters in each beginning
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..
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"]
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.
Thank you for the remport, I change the ref solution (it was very slow endeed). Now it shouldn't timeout.
The description says to return an empty list if any cases match, I assume you meant if none of them match?
I fixed the description. Thank you for the report
From the description, I don't know what should I do if nothing match...
So in the case of
'a ab'
, what should I do?Endeed is added on the test cases an not specify on the description. I added a note in the description, if it helps.
I was wondering if I don't return anything in that case or what to do from reading the description
Fixed tests contain strings which have punctuations, which are not letters. So should they be counted? I don't think such characters should exist in the test cases in the first place, when they're causing the description to contradict itself.
I didn't see the test cases with the punctuations, indeed there shouldn't be any of those. Now is fixed. Thanks
Input parameter should not be named
str
, it's Python's built-in.Thank you for the feedback, completely missed that. It's fixed.