Draft
Classify Planetary Systems (with errors)
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.
Trying C++...
Could you precise the "4- If planets in a row are the same size it will not count as an error for ordered nor antiordered"
Doest it mean that you remove ALL the same values in a row (i.e. {1,3,2,2,2,5} becomes {1,3,5} for ordered, having no error), or does it mean that you keep only the 1rst anomaly meaning 1,3,2,2,2,5 yields to {1,3,2,5} and thus leaves with 1 error ?
Should it be "4- If planets in a row are the same size it will not count as multiple errors for ordered nor antiordered" ?
First off {1, 3, 2, 2, 2, 5} wouldn't be an issue however, none of the two's would be an error, but for {1, 3, 2, 2, 2, 5} none of the 2's would be an error thus none of them should be removed. For this in example in particular 5 would be the error.
For "ordered" type:
What if numErrors was 4, and there was a planet of size 20 somewhere in the middle (let's say between 5 and 6)? Would that still count as ordered system, or do all the errors have to be at the start for that case to work?
And also another question for case: "By having a planet that is too small": [100000000, 10, 12, 13, 14, 15, 1, 2, 16, 17, 18, 19, 20] -> [1, 2] are errors
Can these planets also appear at the start (after sun), or at the end, and not neccessarily the middle?
First you can have errors anywhere in the solar system. For an ordered solar system errors that occur before the first non errored planet are going to be larger, and errors after the first non errored planet are going to be less than. So for your example lets say we have [sun, 10, 7, 5, 1, 2, 3, 4, 5, 20, 6, 7, 8, 9, 10]
I did update the question to clarify the second point here, hopefully this helps.
Thanks! I'll have a look later.
Tests are missing an entire class of test cases where the ideal pattern doesn't start from the first element, e.g
Will create more test cases marking as resolved
Please resolve the issue after you've created the test cases, not before. It's difficult to track what issues still exist otherwise.
Sorry,
Someone was trying to submit their solution, it is not published any more and is being work on.
Added three more difficulties 2 testing edge cases with errors being at the beginning and a final difficulty that is a little more tricky.
There are some inputs where the results can be classified as multiple categories at once, e.g
What are the expected result in these cases?
This will not occur beacuse the min length is more than 50
marking as resolve
This does not answer the issue. These constructs are infinitely extendable, e.g
There is a maximum number of errors depeding on the size of the solar system, you will never have a solar system with only 1 planet that is not an error.
I will clarify this in the problem description
Update the problem description to hopefully clarify, this shouldn't be an issue because the number of errors in a solar system is at most the number of planets (not including the sun) - 1,
These are all equal or less than that. The first one has 149 planets, the second one has 100 planets.
Oops I meant equal to the num of planets (not including the sun) / 2 - 1, At the end all I am trying to say is that you will have more planets that are not errors than errors
Initial code has
std::vector<int>&
but#include <list>
.std::list
andstd::vector
are completely different things: the include should be#include <vector>
.Got left over from insert example should be fixed now
Marking as resolved
The definition of an error for "ordered" needs to be specified. For example, does this contain 1 error or 2?
Relatedly, you should define what "similar in size" means.
Added clarificaiton
Marking as resolved