Draft

Classify Planetary Systems (with errors)

Description
Loading description...
Arrays
Algorithms
  • Please sign in or sign up to leave a comment.
  • eurydice5717 Avatar

    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" ?

    • Sommeba Avatar

      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.

      Question marked resolved by Sommeba 2 years ago
  • B1ts Avatar

    For "ordered" type:

    Given : solarSystem = [100000000, 10, 7, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], numErrors = 3 -> [10, 7, 5] are errors

    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?

    • Sommeba Avatar

      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]

      1. [10, 7, 5,] are all errors because they are all "greater than all non errors from 1 to numErrors * 2 + 1"
      2. 20 would not happen in the problem generation, because "Errors after the first non errored planet will be too small" so you don't need to worry about it. However, in my opinion 20 would be an error.

      I did update the question to clarify the second point here, hopefully this helps.

      Question marked resolved by Sommeba 2 years ago
    • B1ts Avatar

      Thanks! I'll have a look later.

  • Voile Avatar

    Tests are missing an entire class of test cases where the ideal pattern doesn't start from the first element, e.g

    solarSystem = {100000000, 9, 8, 7, 1, 2, 3, 4, 5} errors = 3
    
    solarSystem = {100000000, 2, 3, 4, 5, 5, 5, 5, 5} errors = 3
    
    • Sommeba Avatar

      Will create more test cases marking as resolved

      Issue marked resolved by Sommeba 2 years ago
    • Voile Avatar

      Please resolve the issue after you've created the test cases, not before. It's difficult to track what issues still exist otherwise.

    • Sommeba Avatar

      Sorry,

      Someone was trying to submit their solution, it is not published any more and is being work on.

    • Sommeba Avatar

      Added three more difficulties 2 testing edge cases with errors being at the beginning and a final difficulty that is a little more tricky.

  • Voile Avatar

    There are some inputs where the results can be classified as multiple categories at once, e.g

    solarSystem = {100000000, 5, 6, 4, 7, 3, 5, 5} errors = 4
    
    solarSystem = {100000000, 5} errors = 0
    
    solarSystem = {100000000, 5, 1, 9} errors = 2
    

    What are the expected result in these cases?

    • Sommeba Avatar

      This will not occur beacuse the min length is more than 50

      marking as resolve

      Issue marked resolved by Sommeba 2 years ago
    • Voile Avatar

      This does not answer the issue. These constructs are infinitely extendable, e.g

      solarSystem = {100000000, 50, 51, 49, 52, 48, 53, 47, ..., 99, 1, 50, 50, 50, ..., 50} errors = 98
      
      solarSystem = {100000000, 1, 100, 2, 99, ..., 49, 52, 50, 51} errors = 99
      
    • Sommeba Avatar

      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

    • Sommeba Avatar

      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,

    • Voile Avatar

      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.

    • Sommeba Avatar

      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

  • Voile Avatar

    Initial code has std::vector<int>& but #include <list>. std::list and std::vector are completely different things: the include should be #include <vector>.

  • scarecrw Avatar

    The definition of an error for "ordered" needs to be specified. For example, does this contain 1 error or 2?

    [100000, 1, 4, 2, 3]
    

    Relatedly, you should define what "similar in size" means.