javascript ordered map 92ms
\nconst maximumPopulation = (logs) => {\n    let m = new Map();\n    for (const [b, d] of logs) {\n        for (let y = b; y < d; y++) {\n            m.set(y, m
```\nconst maximumPopulation = (logs) => {\n    let m = new Map();\n    for (const [b, d] of logs) {\n        for (let y = b; y < d; y++) {\n            m.set(y, m.get(y) + 1 || 1);\n        }\n    }\n    m = new Map([...m].sort((x, y) => {\n        if (x[1] == y[1]) return x[0] - y[0]; // if population same, smaller year comes first\n        return y[1] - x[1]; // sort by population decreasing\n    }));\n    return m.keys().next().value;\n};\n```
['JavaScript']