6 kyu
Longest alphabetical substring
1,174 of 3,154Avanta
Loading description...
Fundamentals
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.
Java:
Missing fixed tests
JUnit5 should be used
python new test framework is required. updated in this fork
Approved
This can be done in O(n) time and O(1) extra space.
This was hearder than expected.
I agree
Somebody should translate it in C++
Excuse me, it's not a big issue, but you have a typo in method's name in Java - longestAlp[h]abeticalSubstring
Thanks for reporting. Unfortunately, I'm not sure how I can resolve this issue without invalidating current solutions :/
Oh, I forgot about that you have to invalidate all current solutions, sorry.
It's ok if you want to leave the issue open / re-raise it if you want. Perhaps someone more familiar with Java would know a way to fix it.
Ruby 3.0 should be enabled, see this to learn how to do it
Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)
done
I really enjoyed this kata, thanks to everyone who took part in creating it.
Thank you for enjoying it :)
Hi, i'm new. I tried to solve, and get some failed test, so i checked the code and tested in local and all test pass, with all sample cases and an (attempt) 10k case. i dont want spoile to anyone How can report and show my solution without spoiled someone? or they can check my solution with this comment?
Just post your code with a spoiler tag.
.
There is an issue with the Haskell. In the case of multiple solutions, the tests expect the last one that appears, which is inconsistent with the description and other languages.
I'd greatly appreciate it if someone proficient in the language could fix the issue :)
A fixed fork of the translation is available for approval. I cannot do that myself.
Thank you. I really appreciate it :)
Well I solved it but, in the case of Haskell, the test suite is wrong. The description says that in case of multiple solutions I should return the one that appears first in the string. But that's not the case in the test suite for instance:
longest "abcdeapbcdef" shouldBe "bcdef"
Is clearly wrong. "abcde" is as long as "bcdef" is, and it certainly comes first. I think having a different kata description for this language only will spare some trouble to future coders.
Thanks for that, I've raised an issue about it.
Great kata thanks!
This comment has been hidden.
Hi, when there are multiple solutions, you code doesn't necessarily return the one that appears first.
I'm not too familiar with JS, but maybe
Array.prototype.sort()
isn't stable.I think the problem is that the way you're sorting, you're actually getting the last available substring.
I've edited the test suite to enable Node v12, and your code seems to work with Node v12 but not with any earlier versions.
Thanks Avanta, it worked on Node 12.x version.
Ruby translation kumited -- please check and approve
Thanks, approved
Elixir translation awaiting approval.
Approved, thanks
The instructions part does not state that in case of multiple solutions, the first one has to be returned.
Edited the description, thanks
Haskell translation
Note that I have adjusted the tests ( for Haskell only ) so native
maximumBy
will give correct results.Approved, thanks
The description still says to return the first solution if there are multiple, while the test cases require the last.
Hi @tommmmmm, which language are you talking about?
I have an O(n) solution where I pass through the string once and pass 58 tests fail 0 but get the following error:
STDERR: Max Buffer reached: Too much information has been written to stdout. Signal: Process exited prematurely with a SIGKILL signal.
Just wondering if this is a problem with my code, a proble with the tests in the Kata,a problem with codewars servers. Or a combination. If anyone has any insight on this.
Are you printing some value to the console?
Haha wow thanks so much!!! Yeah had a print in there that I forgot about, it worked instantly and passed. For all the times I have wondered whether it was a problem with my code, the kata, or codewars, 100% of the time it has been my code. Again, thanks!