6 kyu
Simple repeated words
157 of 351KenKamau
Loading description...
Algorithms
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.
Haskell reference solution is incorrect.
solve "" ""
should be1
, not0
.python new test framework
This comment has been hidden.
What's the issue?
Well all the random test cases all expect zero which means that it can be solved in the way I showed above.
So?
You may have a point. Let me check just now.
So isn't that an issue?
Otherwise people can just cheat the kata.
Yes. I'm fixing.
I've added a few more tests to the fixed tests and it appears that your solution still works. So no issue here. Your solution is good.
No my solution doesn't work anymore. You fixed it.
This comment has been hidden.
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.hm, it's a pretty weird case but yes, you'r right, when I covered additional test cases (add 2 lines of code for these cases) that is not included in this kata as result I did't get any error even after 10 pushes into "attempt" button. Do I need to close this issue?
Thanks.
@unnamed, if there is a bug in the ref soln, pls do tell. I didn't understand your post.
itertools combinations gives a time out....how big is the test inputs?
You can print the input array to get a sample.
This comment has been hidden.
Really? Which language?
Fixed in python. Checking the rest.
JS fixed as well. Nice catch!
nice bat ;)
I used to take a subset of target string and count the number of subset strings which matches src,but always get timeout problem.(subset calculations are really cost)... After coming to the toilet, the inspiration came and it was written in one breath.
This comment has been hidden.
...and the prize for the most unimaginative solution function name of the year (i.e. "solve") goes to... this kata! Other than that, however, it was a nice challenge. Congrats! :D
PS: Actually there are several other katas sharing the same generic solution naming practices, but I thought I would just drop my comment on this one, because someone has to do it I guess.
Ok.
Since you edited your response and my comment became obsolete, I edited it too to stay relevant in its context. Do you think that it is worth investing some time into setting more semantic names for functions and their arguments?
Maybe.
Hey,
How does "zaaz" occur in "zazaapulz"?
Take the first letter - 'z', then 'a' on positions 4 and 5 (not indexes) and then take the last 'z'
ZAzAapulZ ZAzaApulZ ZazAApulZ zaZAApulZ
To me it's way too hard for 6 kyu. I wouldn't be surprised to see it as 4 kyu.
agreed
too late now 🤷
This comment has been hidden.
incomplete coverage of the tests: there are no tests (neither fixed nor random) with repeated letters in the first input. That allows wrong implementations to pass.
Test.assert_equals(solve("zaaz","zazaapulz"),4)
Noted. I will fix.
Isn't this more of a suggestion?
nope, an issue: insufficient testing to enforce a proper algorithm (I made a solution that returned 6 for the test above and it passed the whole bunch of tests like a charm). ;)
Fixed.
This comment has been hidden.
For the random tests, the input
b
is made up entirely of the characters from inputa
. Maybe randomly throw in some characters (into inputb
) that are not included in inputa
?Excellent idea. Let me test it and then update.
Done! I have also included some examples in test cases.