• + 0 comments
    const flatlandSpaceStations = (n,c) => {
        let maxDistanceList = [];
        for(let city=0;city<n;city++) {
            let spaceStationDistance = c.map((spaceStation) => Math.abs(city - spaceStation));
            maxDistanceList.push(Math.min(...spaceStationDistance));
        }
        return Math.max(...maxDistanceList);
    }