Maximum Population Year
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given a 2D integer array logs where logs[i] = [birth, death] gives the birth and death years of person i. A person is counted as alive in every year in the half-open range [birth, death - 1]; they are **not** counted in their death year.
The population of a year is the number of people alive in it. Return the earliest year with the maximum population.
Examples
Constraints
- 1 <= logs.length <= 100
- 1950 <= birth < death <= 2050
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.