Easy to understand solution using constraints with 0ms beats 100%.
IntuitionApproachWe track population changes using an array.
We compute cumulative population for each year.
We return the earliest year with the maximum popula
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
We track population changes using an array.
We compute cumulative population for each year.
We return the earliest year with the maximum population.

# Complexity
- Time complexity:
0(n)

- Space complexity:
0(1)
# Code
```java []
class Solution {
    public int maximumPopulation(int[][] logs) {
        int[] years = new int[101]; 
        for (int[] log : logs) {
            years[log[0] - 1950]++; 
            years[log[1] - 1950]--; 
        }
        int maxPopulation = 0, maxYear = 1950;
        int currentPopulation = 0; 

        for (int i = 0; i < years.length; i++) {
            currentPopulation = currentPopulation + years[i]; 
            if (currentPopulation > maxPopulation) {
                maxPopulation = currentPopulation;
                maxYear = 1950 + i; 
            }
        }

        return maxYear;
    }
}

```
['Java']