Ad
  • Custom User Avatar

    Just some personal opinions:

    1. The "priority" field in this problem is only used to maintain the uniqueness of the elements, which is essentially the same as the "value" field. So why is it called "priority"? Perhaps a better approach would be to keep the element with the highest priority when there are duplicate elements?
    2. I don't want to manually check the validity of the input when solving this problem (i.e., check if the input is a set). The problem statement already assumes the input is a set, which should not be the user's responsibility to check.
    3. A set is an unordered structure. If outputting as a list, your test should ensure that the user’s output is correct regardless of its order.
    4. Test cases too weak. It should also contains some fixed tests, and the generated set in the current random tests only contains one element.
  • Custom User Avatar

    Specifying how priority encoding works is no longer necessary. You can do it, but solvers don't need that information any more, so it can't help and might hurt them to have to read it.

    Bullet points (1) and (4) in the first list seem redundant.

    Bullets (2) and (3) in the second list are actually children of the first bullet. Would it be possible to add another layer of indentation there?

  • Custom User Avatar

    Added tests to validate that the function throws errors on invalid input, such as duplicate values with different priorities

  • Custom User Avatar

    Throwing errors isn't tested.

  • Custom User Avatar

    I have corrected the description, is there anything else that needs to be corrected?

  • Custom User Avatar

    so let me add the markup to the description and then we'll look at it again and you can ask questions if you have any because I'm also confused

  • Custom User Avatar

    Wait, did the specs change? I just noticed that both value and priority should match. Was that there the whole time?

  • Custom User Avatar

    I would suggest only testing valid inputs. Input validation has been done to death in other kata, and is just an unrelated additional task. "Do one thing, and do it well." Focus the kata on one, and only one, task, esp. for lower level kata.

  • Custom User Avatar

    absolutely right :) I changed the example and description to suit your issue. If you still have questions, write it :)

  • Custom User Avatar

    Description is now a wall of flat text. Can we have some markup please?

  • Custom User Avatar

    I think you misunderstood ( or, possibly, I did :)

    Higher number means higher priority. But for value: 1, priority: 2 was chosen when priority: 3 is available.

    The example seems to have been changed, and now value: 1 is not in the expected result at all ?!?

  • Custom User Avatar

    The description has been updated to clearly specify the concept of sets and their constraints, and the function signature is now presented separately from the examples for clarity. Thank you for the feedback!

  • Custom User Avatar

    Each set contains unique values. If there are multiple entries with the same value but different priorities, it should be considered invalid and throw an error

  • Custom User Avatar

    "Thank you for the feedback! I have clarified in the description that each set should contain unique values, meaning no duplicate values are allowed within a set, regardless of priority. If a value appears multiple times in a set with different priorities, it will be considered invalid, and an error will be thrown."

  • Custom User Avatar

    Encoding a set as an array of objects leaves open the possibility that either set may contain multiple identical values, possibly with identical or different priorities. Please specify what can and can not happen, and how this impacts the expected result.

  • Loading more items...