Update SetCovering.java (#120)

The statesNeeded and finalStations set should be updated after the for loop which finds the bestStation.
This commit is contained in:
Lu Zhang
2019-10-30 14:32:32 -07:00
committed by Aditya Bhargava
parent 59ee067417
commit 878e26217d

View File

@@ -25,13 +25,13 @@ public class SetCovering {
bestStation = station.getKey();
statesCovered = covered;
}
statesNeeded.removeIf(statesCovered::contains);
}
statesNeeded.removeIf(statesCovered::contains);
if (bestStation != null) {
finalStations.add(bestStation);
}
if (bestStation != null) {
finalStations.add(bestStation);
}
}
System.out.println(finalStations); // [ktwo, kone, kthree, kfive]
}
}
}