Maximum Population Year Problem

Maximum Population Year Problem — ExecCode Easy DSA Practice

Solve the Maximum Population Year problem on ExecCode. Free online easy DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given logs where logs[i] = [birthi, deathi] means a person was alive from birthi (inclusive) to deathi (exclusive), return the earliest year that has the maximum population across the years 1950 to 2050.

Examples

Input logs = [[1993, 1999], [2000, 2010]]; Output 1993. Input logs = [[1950, 1961], [1960, 1971], [1970, 1981]]; Output 1960. Input logs = [[1980, 1990]]; Output 1980

Constraints

1 ≤ logs.length ≤ 100 1950 ≤ birthi < deathi ≤ 2050

Practice Maximum Population Year free on ExecCode. Browse DSA problems, topic map, and placement guides.