You are viewing a single comment's thread. Return to all comments →
Javascript
function flatlandSpaceStations(n, cities) { const map = new Map() for (let i = 0; i < n; i++) { map.set(i, 0) } for (let i = 0; i < n; i++) { let min = Infinity for (let j = 0; j < cities.length; j++) { const city = cities[j] min = Math.min(min, Math.abs(city - i)) } map.set(i, min) min = Infinity } return Math.max(...map.values())
Seems like cookies are disabled on this browser, please enable them to open this website
Flatland Space Stations
You are viewing a single comment's thread. Return to all comments →
Javascript