Easy Python Solution for beginners
Intuition\n Describe your first thoughts on how to solve this problem. \n- This solution iterates through each year in the range of birth years to death years a
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- This solution iterates through each year in the range of birth years to death years and counts the population by checking if the year falls within the inclusive range for each individual. \n- It then keeps track of the maximum population and the corresponding year. \n- While this solution is less efficient for larger input data, it\'s easy to understand.\n\n# Code\n```\nclass Solution:\n    def maximumPopulation(self, logs: List[List[int]]) -> int:\n        min_year = float(\'inf\')  # To find the minimum birth year\n        max_year = float(\'-inf\')  # To find the maximum death year\n    \n    # Find the minimum birth year and maximum death year\n        for birth, death in logs:\n            min_year = min(min_year, birth)\n            max_year = max(max_year, death - 1)\n    \n        max_population = 0\n        max_population_year = None\n    \n    # Iterate through each year and count the population\n        for year in range(min_year, max_year + 1):\n            population = 0\n            for birth, death in logs:\n                if birth <= year <= death - 1:\n                    population += 1\n            if population > max_population:\n                max_population = population\n                max_population_year = year\n    \n        return max_population_year\n```\n![neko ask upvote.jpeg](https://assets.leetcode.com/users/images/6bc1ebc9-a5a1-47e5-8368-cf31c1568ae5_1691603772.7363327.jpeg)\n
['Python3']