Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

greedy_001 adds sets for which all the items are already covered #11

Open
yuvalregev1003 opened this issue Jun 7, 2023 · 0 comments
Open

Comments

@yuvalregev1003
Copy link

yuvalregev1003 commented Jun 7, 2023

@ccoffrin greedy_001 solution (possibly others too, haven't looked into them yet) keeps adding sets until getting full coverage. However - some sets are added for which their items are already covered by previously added sets, thus adding cost but without any value gain.
By adding the following inside the main loop: (tested in 3.10, not in earlier Python versions)

        if len(set(s.items).intersection(covered)) == len(set(s.items)):
            continue

this can be avoided

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

No branches or pull requests

1 participant