Untitled

mail@pastecode.io avatar
unknown
python
2 months ago
401 B
1
Indexable
Never
def solution(stationsA, stationsB, stationsC, origin, destination):
    zoneA = set(stationsA)
    zoneB = set(stationsB)
    zoneC = set(stationsC)

    if origin in zoneA and destination in zoneA:
        return "ABC"
    elif origin in zoneB and destination in zoneB:
        return "AB"
    elif origin in zoneC and destination in zoneC:
        return "BC"
    else:
        return ""
Leave a Comment