egonSchiele / grokking_algorithms

Code for the book Grokking Algorithms (https://amzn.to/29rVyHf)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

08_greedy_algorithms/python/01_set_covering.py

T-CHARE opened this issue · comments

......
for station, states in stations.items():
covered = (states_needed & states)
if len(covered) > len(states_covered):
best_station = station
states_covered = covered
......

should be like this:

......
for station, states in stations.items():
covered = (states_needed & states).union(states)
if len(covered) > len(states_covered):
best_station = station
states_covered = covered
......