❇ maximum-population-year👌 🏆O(N)❤️ Javascript🎯 Memory👀16.15%🕕 ++Explanation✍️ 🔴🔥 ✅ 👉 💪🙏
Time Complexity: O(N)\nSpace Complexity: O(100) =~ O(1)\n\n\n\nvar maximumPopulation = function (logs) {\n    const yearToFrequencyMapping = {};\n    const freq
Time Complexity: O(N)\nSpace Complexity: O(100) =~ O(1)\n![image](https://assets.leetcode.com/users/images/7d61d653-c3ff-45a2-9571-92e1d8eb3537_1716194432.3247647.png)\n\n```\nvar maximumPopulation = function (logs) {\n    const yearToFrequencyMapping = {};\n    const frequencyToLowestYearMapping = {};\n    let maxFrequency = -Infinity;\n    for (const iterator of logs) {\n        const [from, to] = iterator;\n        for (let index = from; index < to; index++) {\n            const element = yearToFrequencyMapping[index];\n            if (!yearToFrequencyMapping[index]) {\n                yearToFrequencyMapping[index] = 0;\n            }\n            yearToFrequencyMapping[index] += 1;\n        }\n    }\n\n    for (const key in yearToFrequencyMapping) {\n        if (maxFrequency < yearToFrequencyMapping[key]) {\n            maxFrequency = yearToFrequencyMapping[key];\n        }\n        if (!frequencyToLowestYearMapping[yearToFrequencyMapping[key]]) {\n            frequencyToLowestYearMapping[yearToFrequencyMapping[key]] = Infinity;\n        }\n        let temp = Number(key);\n        if (frequencyToLowestYearMapping[yearToFrequencyMapping[key]] > temp) {\n            frequencyToLowestYearMapping[yearToFrequencyMapping[key]] = temp;\n        }\n    }\n\n    return frequencyToLowestYearMapping[maxFrequency];\n};\n```
['JavaScript']