Maximum Population Year
EasyIntervals
Decode it first. Clues, constraints, pattern and plan before any code.logs[i] = [birth, death] gives the birth and death years of person i. A person counts toward the population of every year from birth to death - 1: they are not counted in the year they die. Return the year with the largest population. If several years tie, return the earliest one.
[[1993, 1999], [2000, 2010]] → 1993
[[1950, 1961], [1960, 1971], [1970, 1981]] → 1960Constraints
1 <= logs.length <= 1001950 <= birth < death <= 2050