Practice Maximum Population Year
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 2D integer array logs where each logs[i] = [birthi, deathi] indicates the birth and death years of the ith person. The population of some year x is the number of people alive during that year. The ith person is counted in year x's population if x is in the inclusive range [birthi, deathi - 1]. Note that the person is not counted in the year that they die. Return the earliest year with the maximum population.
Source: Maximum Population Year on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
logs = [[1993,1999],[2000,2010]]
1993
# Example 2
logs = [[1950,1961],[1960,1971],[1970,1981]]
1960
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Population Year.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.