Back to problems

House Segments After Deletions

Algorithm · Capital One · Medium

Requirements You receive houses, a list of unique integer coordinates, together with queries, the coordinates that must be removed sequentially. Each coordinate listed in queries occurs in houses, and no coordinate is requested for deletion twice. A segment consists of at least one surviving house in consecutive positions, with no surviving house directly adjacent to either end beyond that run. Whenever a query removes a house, record the resulting count of surviving…

Checking your access…