Fixed formatting problems
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
// You pass an array in, and it gets converted to a set.
|
||||
let statesNeeded = new Set(['mt', 'wa', 'or', 'id', 'nv', 'ut', 'ca', 'az']);
|
||||
let statesNeeded = new Set(["mt", "wa", "or", "id", "nv", "ut", "ca", "az"]);
|
||||
|
||||
const stations = {};
|
||||
stations.kone = new Set(['id', 'nv', 'ut']);
|
||||
stations.ktwo = new Set(['wa', 'id', 'mt']);
|
||||
stations.kthree = new Set(['or', 'nv', 'ca']);
|
||||
stations.kfour = new Set(['nv', 'ut']);
|
||||
stations.kfive = new Set(['ca', 'az']);
|
||||
stations.kone = new Set(["id", "nv", "ut"]);
|
||||
stations.ktwo = new Set(["wa", "id", "mt"]);
|
||||
stations.kthree = new Set(["or", "nv", "ca"]);
|
||||
stations.kfour = new Set(["nv", "ut"]);
|
||||
stations.kfive = new Set(["ca", "az"]);
|
||||
|
||||
const finalStations = new Set();
|
||||
|
||||
|
||||
while (statesNeeded.size) {
|
||||
let bestStation = null;
|
||||
let statesCovered = new Set();
|
||||
Object.keys(stations).forEach((station) => {
|
||||
Object.keys(stations).forEach(station => {
|
||||
const states = stations[station];
|
||||
const covered = new Set([...statesNeeded].filter(x => states.has(x)));
|
||||
if (covered.size > statesCovered.size) {
|
||||
|
||||
Reference in New Issue
Block a user