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:
committed by
Aditya Bhargava
parent
59ee067417
commit
878e26217d
@@ -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]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user