6 kyu
Repeated Substring
895 of 2,062opportunity356
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.
python new test framework + random tests are required. updated in this fork
Approved
This comment has been hidden.
This no longer works for the Ruby test
Getting STDER error after passing all tests. Can someone explain what's up? Works in my IRB environment fine, no error throws. Also references the error on a line where only code is 'end'.
good kata
Somehow solved this. Ugly code, but solved atleast. xD
could someone explain why it is worng
initial string is "abcoabc"
expected [ 'abc', 2 ] to deeply equal [ 'abcoabc', 1 ]
That would be true if the string was
"abcabc"
.COBOL translation.
approved
Description not up to date. For every language except C, it is explained what to return.
looks like there are some other problems with the language names: switching from JS to python, there is an additional code block that is showing up
Another fine example of the maintenance hell when providing language specific blocks :) I would stay away from those unless the kata is specific to a certain language.
done
C translation (author gone)
it includes random tests
thanks :)
Could you also check the issue I posted concerning the general description, which requires some info about C?
Nice kata! better to have more random tests although!
Ruby 3.0 should be enabled.
Enabled in this fork
The kata was great and I enjoyed it. I do have constructive feedback for instructions though. While you did specify in the description that the substring multiplied by a number should equal the entire string itself, that specific detail could have been more descript and/or clear. Also, including the fact that a substring can be one character is helpful. I see how it is not entirely needed though as well.
No random tests.
Added for Python, still missing for JS and Ruby
Added for Ruby
Python 3 should be enabled.
it is
Enter the Mind of The Beast...
For me the description is not clear: I'd search for the shortest (minimum) substring first with an appearence highest (maximum) of the matches. Therefore in "abcabcabc" I'd find a result to be ["ab", 3], because that is the shortest substring (minimum?)
Can anyone tell me why could I interpret this in a wrong way? Does it mean that I am not too good in Math?
This comment has been hidden.
I had the same issue, but it's supposed to be that the entire string is equal to
t
*k
, not just a substring (which is a substantially harder problem!).So, the answer for
'abba'
is actually['abba', 1]
, not['b', 2]
. I'm going to edit the description to make this clearer.Ah, cool, thanks for the clarification!
Translated it into js and Ruby, so if you want to add those versions, just do it :)
In case you feel like adding random tests or extralong strings, just let me know [preferably commenting on the translations, it seems this gives better chance of being notified] and I will fix the kumited versions accordingly :)
The initial solution was already preloaded with an almost working solution for the js version, I removed it.
Ops, my bad; I see it survived even jhoffner scrutiny, but it was undoubtedly my original mistake.
Thanks for the fix :)
At the beginning, the description specifies that t should be a minimum substring. At the end, it says it should be a maximum substring.
Thank you for your remark! I've rectified this mistake.
It would be nice to have large test cases to force linear complexity
Thank you for your suggestions! I've edited the description and tests. Hope I've fixed all that you had mentioned before.
Looks good to me. Thanks for adding another example too; I think that will help show what you intend.
description needs to be cleaned up a bit.
It should be mentioned in description, that if two substrings have equal number of occurences, the longer string must be returned.
And even better, if there're two or more substrings of equal length occuring the same number of time (like in abcdefdefabc), it should be specified, which of them must be returned, or the tests must be designed so that either answer would be accepted.
Maybe I'm inattentive or not so good at English, but I read the kata description so that I should find a substring that is repeated maximum times in s. Now after reading again I see that s must contain only the repetitions of t and nothing else, so for 'abcdefdefabc' the answer is not ('abc', 2) or ('def', 2), but ('abcdefdefabc', 1). Maybe it would be nice to make description a bit longer and somehow elaborate this difference.
Typo in kata description: lowwercase
Searching such an i that s[:i] == s[-i:] passes all the tests.