Amazon Sample Questions Flashcards

1
Q

Most People Alive

Given a list of people with their birth and end years (all between 1900 and 2000), find the year with the most number of people alive.

A

Create 2 tables, birthdates and deathdates.

Accumulate birth dates and death dates in those tables.

Browse those tables to accumulate the number of alive people at the time.

Grand total complexity is O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly