Untitled
unknown
python
2 years ago
741 B
5
Indexable
def solution(stationsA, stationsB, stationsC, origin, destination):
o, d = ' ', ' '
for station in stationsA:
if origin == station:
o = 'A'
if destination == station:
d = 'A'
for station in stationsB:
if origin == station:
o = 'B'
if destination == station:
d = 'B'
for station in stationsC:
if origin == station:
o = 'C'
if destination == station:
d = 'C'
if d == ' ' or o == ' ':
return ""
if o == 'A' and d == 'B':
return "AB"
if o == 'A' and d == 'C':
return "ABC"
if o == 'B' and d == 'C':
return "BC"
return ""Editor is loading...
Leave a Comment