Medium · Hash Maps

Find year with most population

Given a non-empty list of people as [birth, death] year pairs, where each person counts as alive in every year from birth through death inclusive, return the earliest year in which the largest number of people were alive.

Examples

Example 1

[[1993,1999],[2000,2010]]

Output: year 1993

Example 2

[[1950,1961],[1960,1971],[1960,1971]]

Output: year 1960

Rebuild it in the studio

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Hash Maps problems