Leetcode 1854. Maximum Population Year
2021-05-12 16:15 作者:您是打尖儿还是住店呢 | 我要投稿
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.
用的是最简单的遍历的方法;
Runtime: 2 ms, faster than 59.69% of Java online submissions for Maximum Population Year.
Memory Usage: 36.8 MB, less than 90.31% of Java online submissions for Maximum Population Year.