Maximum Population Year LeetCode solution in JavaScript
1var maximumPopulation = function (logs) {2const count = new Array(101).fill(0);34for (const [birth, death] of logs) {5count[birth - 1950]++;6count[death - 1950]--;7}89let max = 0;1011for (let i = 1; i < 101; i++) {12count[i] += count[i - 1];1314if (count[i] > count[max]) max = i;15}1617return 1950 + max;18};