6 kyu
Summarize ranges
321 of 657joh_pot
Loading description...
Arrays
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 is required. updated in this fork
Approved
Ruby 3.0 should be enabled, see this to learn how to do it
Enabled in this fork
Too similar to https://www.codewars.com/kata/range-extraction
The kata is 2.5 years old, it is not an issue.
It doesn't change the fact that it's a duplicate (of an even older kata)
For the ruby tests this seems wrong:
["-2", "0", "-1", "-3"] Expected: ["-2", "0", "-1", "-3->-2"], instead got: ["-2", "0", "-1", "-3"]
the inital input is unsorted and there are no ranges but the results says the last value should have a range -3->-2. That seems wrong.
Leftover from previous tests I did, sorry and fixed (your example test case won't update, but the rest should be fine) :)!
Thanks. Works now.
Python tests use unsorted arrays.
['-2', '0', '-1', '-1', '-1'] should equal ['-2', '0', '-1->0', '-1->0', '-1']
Leftover from previous tests I did, sorry and fixed (your example test case won't update, but the rest should be fine) :)!
.
This comment has been hidden.
Which language :)?
If it is either Python or Ruby, post under my comment down below.
Yes, it's Python.
Leftover from previous tests I did, sorry and fixed (your example test case won't update, but the rest should be fine) :)!
Thanks a lot! Now it works.
This comment has been hidden.
Leftover from previous tests I did, sorry and fixed (your example test case won't update, but the rest should be fine) :)!
.
Python tests are unordered but is easy to deal with that. The main problem is that the random inputs have always an extra element. In this example there is an extra "-2" that does not make any sense.
It should work for random inputs too: ['8', '6', '-1', '6', '9', '1', '9', '0', '4', '-4', '-1', '1', '5', '-4'] should equal ['8', '6', '-1', '6', '9', '1', '9', '0', '4', '-4', '-1', '1', '5', '-4', '-2']
Yes, that is not right. I have asked the translator to have a look when he has time. Thanks for reporting.
Leftover from previous tests I did, sorry and fixed (your example test case won't update, but the rest should be fine) :)!
.
Python tests are broken, see example:
Testing for [9, 9, 2, 5] It should work for random inputs too: ['9', '2', '5'] should equal []
The answer is ['9', '2', '5'], not [].
Yes, that is not right. I have asked the translator to have a look when he has time. Thanks for reporting.
Fixed (or so I hope), sorry for the inconvenience!
.
I think something may be wrong with the test cases. Using Ruby btw, the last two are very strange. Test Passed: Value == [] Test Passed: Value == ["1"] Test Passed: Value == ["1->4"] Test Passed: Value == ["0->2", "5->6", "9"] Test Passed: Value == ["0->7"] Test Passed: Value == ["0->7"] Test Passed: Value == ["0->7", "9->10"] Test Passed: Value == ["-2", "0->7", "9->10", "12"] Expected: ["-2", "0", "-1", "-3->-2"], instead got: ["-2", "0"] Expected: ["-2", "0", "-1->0", "-1->0", "-1"], instead got: ["-2", "0"]
I noticed that in Python too, some test inputs are not sorted. This contradicts the problem statement but it is possible to adjust solutions to cope with unsorted input easily enough.
Perhaps the problem statement should be amended to indicated that the overall array is not necessarily sorted, but some ranges within the array are.
Arrays should be sorted. It is an oversight from the Python and Ruby translator. I will ask him to fix up the test cases. Thanks for reporting this.
same problem using Python ['-3->0'] should equal ['-2', '0', '-1', '-3->-2']
Fixed (or so I hope), sorry for the inconvenience!
This problem still exists in the Ruby tests.
['-3->0'] should equal ['-2', '0', '-1', '-3->-2']. Please fix.
The random test cases were fixed, I forgot to check the basics: now is done!
ty Giacomo it worked!
it works, finally! :)
Python tests use unsorted arrays.
Fixed (or so I hope), sorry for the inconvenience!
.
Translations submitted, thanks for this one too :)
P.S.: as usual, if you post under this to remind me of changing the description, I would appreciate ;)
Thanks for your translations! Approved.