Skip to content

Conversation

@milvito
Copy link

@milvito milvito commented Jan 12, 2023

While checking other solutions I found, that some solutions tries to maximize single size group count. Or remove one size of group and calculates result without using that group(or by maximizing that size group). These solutions pass all current tests. E.g.

{
      "uuid": "78cacb57-911a-45f1-be52-2a5bd428c634",
      "description": "Two groups of four is cheaper than group of five plus group of three",
      "comments": ["Suggested grouping, [[1,2,3,4],[1,2,3,5]]."],
      "property": "total",
      "input": {
        "basket": [1, 1, 2, 2, 3, 3, 4, 5]
      },
      "expected": 5120
    },

This test is passed by trying solve without using 5 size group. Example of solution, that passes all current tests:
https://exercism.org/tracks/go/exercises/book-store/solutions/klaus-trausner.

That kind of solutions would fail on this new test:
//would fail if tries to solve by removing group of size 4
groupPrice(5)+groupPrice(5)+groupPrice(3) = 3000+3000+2160 = 8160
//would fail if tries to solve by removing group of size 5
groupPrice(4)+(groupPrice4)+groupPrice(4)+groupPrice(1)= 2560 + 2560 +2560 + 800 = 8480
//correct
groupPrice(5)+groupPrice(4)+groupPrice(4) = 2560 + 2560 + 3000 = 8120

@github-actions
Copy link
Contributor

Hello. Thanks for opening a PR on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.

That doesn't mean we're not interested in your ideas, or that if you're stuck on something we don't want to help. The best place to discuss things is with our community on the Exercism Community Forum. You can use this link to copy this into a new topic there.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@petertseng

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants