You are building a feature that suggests a split stay: a guest stays in one home for the first part of a trip, then switches to a second home for the remainder.
You are given:
availability
from
listing name
(e.g., "A", "B") to a list of
available day numbers
(integers).
[startDay, endDay]
inclusive.
Return all valid split-stay options:
[startDay, endDay]
.
(L1, L2)
for which there exists a split day
k
with
startDay <= k < endDay
such that:
L1
is available for every day in
[startDay, k]
, and
L2
is available for every day in
[k+1, endDay]
.
Notes / clarifications:
L1 != L2
).
Example:
A = [1,2,3,6,7,10,11]
B = [3,4,5,6,8,9,10,13]
C = [7,8,9,10,11]
[3, 11]
Determine which single listings and/or two-listing split stays satisfy the rules above.