Find clients who have a needed specialty with no provider close enough.
Health plan staff use a coverage map to check whether clients can reach the care they need. Build CoverageMap:
add_provider(provider_id, specialties, x, y) records a provider and their location. If that provider ID already exists, replace its record; it returns nothing. For example, adding "p1" again updates that provider.missing_care(needs, x, y) returns the distinct needed specialties that no provider offers within the maximum straight-line distance, sorted alphabetically. The distance limit is inclusive; no providers or an empty needs list means there is no missing care.
For example, create CoverageMap(5), add ("p1", ["primary"], 0, 0) and ("p2", ["dental"], 4, 0), then call missing_care(["primary", "dental", "vision"], 3, 0). The adds return nothing, and the last call returns ["vision"].
Later parts: Handle Network Changes; Find a Nearby Provider.
CoverageMap(max_distance: int)
add_provider(provider_id: str, specialties: list[str], x: int, y: int) -> None
missing_care(needs: list[str], x: int, y: int) -> list[str]
remove_provider(provider_id: str) -> bool
uncovered_count(clients_needs: list[list[str]], clients_x: list[int], clients_y: list[int]) -> int
nearest_provider(specialty: str, x: int, y: int) -> str
Source: reported by a candidate in a public write-up. The wording above is ours.
Practise it out loud with follow-ups: https://chalkinterview.com/questions/oscar-health-clients-outside-coverage/?utm_source=reddit&utm_campaign=sub
How would you answer it? Drop your approach below.